From 5499a57640e8ffe8d3ac7dcbf6a0a99adc27e7fb Mon Sep 17 00:00:00 2001 From: zijianhuang Date: Tue, 11 Jun 2024 17:35:11 +1000 Subject: [PATCH] refactoring --- CreateDemoTextJsonWebClientApi.ps1 | 4 +- .../WebApiClientTextJsonAuto.cs | 4002 +---------------- .../Properties/launchSettings.json | 15 +- DemoTextJsonWeb/appsettings.json | 16 +- .../WebApiCoreNG2FormGroupClientAuto.ts | 1415 +----- .../src/clientapi/WebApiCoreNg2ClientAuto.ts | 935 ---- StartDemoTextJsonWeb.ps1 | 4 +- .../IntegrationTestsTextJson/appsettings.json | 2 +- .../clientapi/WebApiCoreAureliaClientAuto.ts | 935 ---- .../clientapi/WebApiCoreAxiosClientAuto.ts | 930 ---- .../clientapi/WebApiCoreFetchClientAuto.ts | 930 ---- 11 files changed, 133 insertions(+), 9055 deletions(-) diff --git a/CreateDemoTextJsonWebClientApi.ps1 b/CreateDemoTextJsonWebClientApi.ps1 index 3907dd4b..dce49f0a 100644 --- a/CreateDemoTextJsonWebClientApi.ps1 +++ b/CreateDemoTextJsonWebClientApi.ps1 @@ -4,7 +4,7 @@ cd $PSScriptRoot $path = "$PSScriptRoot/DemoTextJsonWeb" $procArgs = @{ FilePath = "dotnet.exe" - ArgumentList = "run $path/DemoTextJsonWeb.csproj --no-build" + ArgumentList = "run $path/DemoTextJsonWeb.csproj --no-build --launch-profile CodeGen" WorkingDirectory = $path PassThru = $true } @@ -12,7 +12,7 @@ $process = Start-Process @procArgs #Step 2: Run CodeGen $restArgs = @{ - Uri = 'http://localhost:6000/api/codegen' + Uri = 'http://localhost:5000/api/codegen' Method = 'Post' InFile = "$path/CodeGen.json" ContentType = 'application/json' diff --git a/DemoCoreWeb.ClientApiTextJson/WebApiClientTextJsonAuto.cs b/DemoCoreWeb.ClientApiTextJson/WebApiClientTextJsonAuto.cs index 2216f778..c3b9ab21 100644 --- a/DemoCoreWeb.ClientApiTextJson/WebApiClientTextJsonAuto.cs +++ b/DemoCoreWeb.ClientApiTextJson/WebApiClientTextJsonAuto.cs @@ -9288,3726 +9288,26 @@ public class TokenResponseModel : object public string Username { get; set; } } } -namespace Fonlow.PoemsApp.Data.Client -{ - - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class Album : object - { - - [System.Runtime.Serialization.DataMember()] - public Fonlow.PoemsApp.Data.Client.BodyType BodyType { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Description { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - /// - /// Author should be able to alter. The default is the created time. DateTime. - /// - [System.Runtime.Serialization.DataMember()] - public System.Nullable Published { get; set; } - - /// - /// First published Url - /// - [System.Runtime.Serialization.DataMember()] - public string PublishedUrl { get; set; } - - /// - /// Album title should never be changed. - /// - [System.Runtime.Serialization.DataMember()] - public string Title { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class Annotation : object - { - - /// - /// HTML description - /// - [System.Runtime.Serialization.DataMember()] - public string Description { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - /// - /// - [System.Runtime.Serialization.DataMember()] - public string Name { get; set; } - - /// - /// Primary URL for online description like an entry in Wikipedia - /// - [System.Runtime.Serialization.DataMember()] - public string Url { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class AnnotationBrief : object - { - - /// - /// Count of poems associated - /// - [System.Runtime.Serialization.DataMember()] - public System.Nullable Count { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.Guid Id { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public string Name { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class AnnotationPoemCount : Fonlow.PoemsApp.Data.Client.MetaDataPoemCount - { - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public enum BodyType - { - - [System.Runtime.Serialization.EnumMember()] - Text, - - [System.Runtime.Serialization.EnumMember()] - HTML, - - [System.Runtime.Serialization.EnumMember()] - MD, - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class ExternalImageMap : object - { - - [System.Runtime.Serialization.DataMember()] - public string Description { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Name { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid[] PoemIds { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string SrcUrl { get; set; } - } - - /// - /// For wrting or speaking. - /// https://www.loc.gov/standards/iso639-2/php/code_list.php - /// https://www.rfc-editor.org/rfc/rfc5646 - /// https://iso639-3.sil.org/code_tables/639/read - /// https://iso639-3.sil.org/code_tables/download_tables - /// - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class LanguageCode : object - { - - /// - /// iso639 code. Could be 639-3, 639-2 or 639-1 - /// - [System.Runtime.Serialization.DataMember()] - public string Code { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Display { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class LoginModel : object - { - - [System.Runtime.Serialization.DataMember()] - public string EmailAddress { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string FirstName { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string IdToken { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string LastName { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Name { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string PictureUrl { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Provider { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string UserId { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class MetaData : object - { - - [System.Runtime.Serialization.DataMember()] - public string Key { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Value { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class MetaDataPoemCount : object - { - - /// - /// Count of poems associated - /// - [System.Runtime.Serialization.DataMember()] - public int Count { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.Guid Id { get; set; } - } - - /// - /// Associated with a specific poem only. - /// In case when a phase may be up to different interpretations, then used numbered annotation. - /// - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class NumberedAnnotation : object - { - - /// - /// HTML description - /// - [System.Runtime.Serialization.DataMember()] - public string Description { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - /// - /// Range: inclusive between 1 and 2147483647 - /// - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.ComponentModel.DataAnnotations.Range(typeof(System.Int32), "1", "2147483647")] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public int OrderNumber { get; set; } - - /// - /// - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.Guid PoemId { get; set; } - - /// - /// Primary URL for online description like an entry in Wikipedia - /// - [System.Runtime.Serialization.DataMember()] - public string Url { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class NumberedAnnotationBrief : object - { - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.Guid Id { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public int OrderNumber { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class Picture : Fonlow.PoemsApp.Data.Client.PictureMeta - { - - [System.Runtime.Serialization.DataMember()] - public byte[] Content { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PictureMeta : object - { - - [System.Runtime.Serialization.DataMember()] - public string ContentType { get; set; } - - /// - /// Max length: 512 - /// - [System.ComponentModel.DataAnnotations.MaxLength(512)] - [System.Runtime.Serialization.DataMember()] - public string Description { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - /// - /// Max length: 128 - /// - [System.ComponentModel.DataAnnotations.MaxLength(128)] - [System.Runtime.Serialization.DataMember()] - public string Name { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PicturePoemCount : Fonlow.PoemsApp.Data.Client.MetaDataPoemCount - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid[] PoemIds { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class Poem : object - { - - /// - /// A poem may be included in multipe albums. - /// UI may use this to present albums - /// - [System.Runtime.Serialization.DataMember()] - public System.Guid[] AlbumIds { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid[] AnnotationIds { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Body { get; set; } - - /// - /// When bodytype is HTML, a redundant copy for full text search. A poor man solution. - /// - [System.Runtime.Serialization.DataMember()] - public string BodyPlain { get; set; } - - [System.Runtime.Serialization.DataMember()] - public Fonlow.PoemsApp.Data.Client.BodyType BodyType { get; set; } - - /// - /// Author should be able to alter. The default is the created time. - /// - [System.Runtime.Serialization.DataMember()] - public System.Nullable Created { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Nullable Modified { get; set; } - - [System.Runtime.Serialization.DataMember()] - public Fonlow.PoemsApp.Data.Client.NumberedAnnotationBrief[] NumberedAnnotationBriefs { get; set; } - - [System.Runtime.Serialization.DataMember()] - public int NumberOfStanza { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid[] PictureIds { get; set; } - - /// - /// to distinguish draft or published. DateTime. - /// - [System.Runtime.Serialization.DataMember()] - public System.Nullable Published { get; set; } - - /// - /// Initial published URL. - /// - [System.Runtime.Serialization.DataMember()] - public string PublishedUrl { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string RyhmesCsv { get; set; } - - /// - /// UI use this to represent tags. This is not included n DB. - /// - [System.Runtime.Serialization.DataMember()] - public System.Guid[] TagIds { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Title { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemAlbumMap : object - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid AlbumId { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid PoemId { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemAnnotationMap : object - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid AnnotationId { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid PoemId { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemBrief : object - { - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.DateTime Date { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public System.Guid Id { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Nullable Published { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid[] TagIds { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public string Title { get; set; } - } - - /// - /// Highest level container for every poems written by a poet, for exporting to other formats - /// - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemCollection : object - { - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.PoemAlbumMap[] AlbumMaps { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.Album[] Albums { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.PoemAnnotationMap[] AnnotationMaps { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.Annotation[] Annotations { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.MetaData[] KeyValues { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.NumberedAnnotation[] NumberedAnnotations { get; set; } - - [System.Runtime.Serialization.DataMember()] - public Fonlow.PoemsApp.Data.Client.PoemPictureMap[] PictureMaps { get; set; } - - [System.Runtime.Serialization.DataMember()] - public Fonlow.PoemsApp.Data.Client.PictureMeta[] PictureMetas { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.Poem[] Poems { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.PoemTagMap[] TagMaps { get; set; } - - [System.ComponentModel.DataAnnotations.RequiredAttribute()] - [System.Runtime.Serialization.DataMember(IsRequired =true)] - public Fonlow.PoemsApp.Data.Client.Tag[] Tags { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemPictureMap : object - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid PictureId { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid PoemId { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class PoemTagMap : object - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid PoemId { get; set; } - - [System.Runtime.Serialization.DataMember()] - public System.Guid TagId { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class Tag : object - { - - [System.Runtime.Serialization.DataMember()] - public System.Guid Id { get; set; } - - [System.Runtime.Serialization.DataMember()] - public string Name { get; set; } - } - - [System.Runtime.Serialization.DataContract(Namespace="http://fonlowdemo.com/2020/09")] - [System.SerializableAttribute()] - public class TagPoemCount : Fonlow.PoemsApp.Data.Client.MetaDataPoemCount - { - } -} -namespace DemoCoreWeb.Controllers.Client -{ - using System; - using System.Linq; - using System.Collections.Generic; - using System.Threading.Tasks; - using System.Net.Http; - using System.Text.Json; - using System.Text.Json.Serialization; - using Fonlow.Net.Http; - - - public partial class SpecialTypes - { - - private System.Net.Http.HttpClient client; - - private JsonSerializerOptions jsonSerializerSettings; - - public SpecialTypes(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) - { - if (client == null) - throw new ArgumentNullException(nameof(client), "Null HttpClient."); - - if (client.BaseAddress == null) - throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress"); - - this.client = client; - this.jsonSerializerSettings = jsonSerializerSettings; - } - - /// - /// Anonymous Dynamic of C# - /// GET api/SpecialTypes/AnonymousDynamic - /// - /// dyanmic things - public async Task GetAnonymousDynamicAsync(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousDynamic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Anonymous Dynamic of C# - /// GET api/SpecialTypes/AnonymousDynamic - /// - /// dyanmic things - public System.Text.Json.Nodes.JsonObject GetAnonymousDynamic(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousDynamic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async function returing dynamic - /// GET api/SpecialTypes/AnonymousDynamic2 - /// - public async Task GetAnonymousDynamic2Async(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousDynamic2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async function returing dynamic - /// GET api/SpecialTypes/AnonymousDynamic2 - /// - public System.Text.Json.Nodes.JsonObject GetAnonymousDynamic2(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousDynamic2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/SpecialTypes/AnonymousObject - /// - public async Task GetAnonymousObjectAsync(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/SpecialTypes/AnonymousObject - /// - public System.Text.Json.Nodes.JsonObject GetAnonymousObject(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async function returning object - /// GET api/SpecialTypes/AnonymousObject2 - /// - public async Task GetAnonymousObject2Async(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async function returning object - /// GET api/SpecialTypes/AnonymousObject2 - /// - public System.Text.Json.Nodes.JsonObject GetAnonymousObject2(Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/SpecialTypes/AnonymousObject - /// - public async Task PostAnonymousObjectAsync(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/SpecialTypes/AnonymousObject - /// - public System.Text.Json.Nodes.JsonObject PostAnonymousObject(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async returning object, Post dynamic - /// POST api/SpecialTypes/AnonymousObject2 - /// - public async Task PostAnonymousObject2Async(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Async returning object, Post dynamic - /// POST api/SpecialTypes/AnonymousObject2 - /// - public System.Text.Json.Nodes.JsonObject PostAnonymousObject2(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) - { - var requestUri = "api/SpecialTypes/AnonymousObject2"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - } -} -namespace PoemsApp.Controllers.Client -{ - using System; - using System.Linq; - using System.Collections.Generic; - using System.Threading.Tasks; - using System.Net.Http; - using System.Text.Json; - using System.Text.Json.Serialization; - using Fonlow.Net.Http; - - - /// - /// Album specific operations - /// - public partial class Albums - { - - private System.Net.Http.HttpClient client; - - private JsonSerializerOptions jsonSerializerSettings; - - public Albums(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) - { - if (client == null) - throw new ArgumentNullException(nameof(client), "Null HttpClient."); - - if (client.BaseAddress == null) - throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress"); - - this.client = client; - this.jsonSerializerSettings = jsonSerializerSettings; - } - - /// - /// Add album. If publisheDate is not defined, it will be now. - /// POST api/Albums - /// - public async Task AddAsync(Fonlow.PoemsApp.Data.Client.Album album, Action handleHeaders = null) - { - var requestUri = "api/Albums"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(album, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add album. If publisheDate is not defined, it will be now. - /// POST api/Albums - /// - public Fonlow.PoemsApp.Data.Client.Album Add(Fonlow.PoemsApp.Data.Client.Album album, Action handleHeaders = null) - { - var requestUri = "api/Albums"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(album, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemAlbumMap. - /// DELETE api/Albums?id={id} - /// - public async Task DeleteAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Albums?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemAlbumMap. - /// DELETE api/Albums?id={id} - /// - public bool Delete(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Albums?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get Album. Support ZH Convert. - /// GET api/Albums?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Albums?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get Album. Support ZH Convert. - /// GET api/Albums?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.Album Get(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Albums?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all albums. Support ZH Convert. - /// GET api/Albums/all - /// - /// int in header - public async Task GetAllAsync(Action handleHeaders = null) - { - var requestUri = "api/Albums/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all albums. Support ZH Convert. - /// GET api/Albums/all - /// - /// int in header - public Fonlow.PoemsApp.Data.Client.Album[] GetAll(Action handleHeaders = null) - { - var requestUri = "api/Albums/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all albums as dictionary. Support ZH Convert. - /// GET api/Albums/allDic - /// - /// int in header - public async Task> GetAllDicAsync(Action handleHeaders = null) - { - var requestUri = "api/Albums/allDic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all albums as dictionary. Support ZH Convert. - /// GET api/Albums/allDic - /// - /// int in header - public System.Collections.Generic.IDictionary GetAllDic(Action handleHeaders = null) - { - var requestUri = "api/Albums/allDic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Albums - /// - public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Album album, Action handleHeaders = null) - { - var requestUri = "api/Albums"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(album, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Albums - /// - public void Update(Fonlow.PoemsApp.Data.Client.Album album, Action handleHeaders = null) - { - var requestUri = "api/Albums"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(album, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - } - - /// - /// Annotations management - /// - public partial class Annotations - { - - private System.Net.Http.HttpClient client; - - private JsonSerializerOptions jsonSerializerSettings; - - public Annotations(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) - { - if (client == null) - throw new ArgumentNullException(nameof(client), "Null HttpClient."); - - if (client.BaseAddress == null) - throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress"); - - this.client = client; - this.jsonSerializerSettings = jsonSerializerSettings; - } - - /// - /// POST api/Annotations - /// - public async Task AddAsync(Fonlow.PoemsApp.Data.Client.Annotation annotation, Action handleHeaders = null) - { - var requestUri = "api/Annotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(annotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Annotations - /// - public System.Guid Add(Fonlow.PoemsApp.Data.Client.Annotation annotation, Action handleHeaders = null) - { - var requestUri = "api/Annotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(annotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemAnnotationMap. - /// DELETE api/Annotations?id={id} - /// - public async Task DeleteAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Annotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemAnnotationMap. - /// DELETE api/Annotations?id={id} - /// - public bool Delete(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Annotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Annotations/Orphaned - /// - public async Task DeleteOrphanedAsync(System.Guid[] ids, Action handleHeaders = null) - { - var requestUri = "api/Annotations/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(ids, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Annotations/Orphaned - /// - public int DeleteOrphaned(System.Guid[] ids, Action handleHeaders = null) - { - var requestUri = "api/Annotations/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(ids, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get annotation. Support ZH Convert. - /// GET api/Annotations?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Annotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get annotation. Support ZH Convert. - /// GET api/Annotations?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.Annotation Get(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Annotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/all - /// - public async Task GetAnnotationBriefsAsync(Action handleHeaders = null) - { - var requestUri = "api/Annotations/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/all - /// - public Fonlow.PoemsApp.Data.Client.AnnotationBrief[] GetAnnotationBriefs(Action handleHeaders = null) - { - var requestUri = "api/Annotations/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all annotation briefs. Support ZH Convert. - /// GET api/Annotations/allDic - /// - public async Task> GetAnnotationBriefsDicAsync(Action handleHeaders = null) - { - var requestUri = "api/Annotations/allDic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get all annotation briefs. Support ZH Convert. - /// GET api/Annotations/allDic - /// - public System.Collections.Generic.IDictionary GetAnnotationBriefsDic(Action handleHeaders = null) - { - var requestUri = "api/Annotations/allDic"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/Orphaned - /// - public async Task GetOrphanedAsync(Action handleHeaders = null) - { - var requestUri = "api/Annotations/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/Orphaned - /// - public Fonlow.PoemsApp.Data.Client.AnnotationBrief[] GetOrphaned(Action handleHeaders = null) - { - var requestUri = "api/Annotations/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/PoemCountOfAnnotations - /// - public async Task GetPoemCountOfAnnotationsAsync(Action handleHeaders = null) - { - var requestUri = "api/Annotations/PoemCountOfAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Annotations/PoemCountOfAnnotations - /// - public Fonlow.PoemsApp.Data.Client.AnnotationPoemCount[] GetPoemCountOfAnnotations(Action handleHeaders = null) - { - var requestUri = "api/Annotations/PoemCountOfAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Annotations - /// - public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Annotation annotation, Action handleHeaders = null) - { - var requestUri = "api/Annotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(annotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Annotations - /// - public void Update(Fonlow.PoemsApp.Data.Client.Annotation annotation, Action handleHeaders = null) - { - var requestUri = "api/Annotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(annotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - } - - /// - /// Annotations management - /// - public partial class NumberedAnnotations - { - - private System.Net.Http.HttpClient client; - - private JsonSerializerOptions jsonSerializerSettings; - - public NumberedAnnotations(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) - { - if (client == null) - throw new ArgumentNullException(nameof(client), "Null HttpClient."); - - if (client.BaseAddress == null) - throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress"); - - this.client = client; - this.jsonSerializerSettings = jsonSerializerSettings; - } - - /// - /// POST api/NumberedAnnotations - /// - public async Task AddAsync(Fonlow.PoemsApp.Data.Client.NumberedAnnotation numberedAnnotation, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(numberedAnnotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/NumberedAnnotations - /// - public System.Guid Add(Fonlow.PoemsApp.Data.Client.NumberedAnnotation numberedAnnotation, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(numberedAnnotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add multiple annotations - /// POST api/NumberedAnnotations/poem/{poemId} - /// - public async Task AddMuitipleAsync(System.Guid poemId, int[] orderNumbers, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/poem/"+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(orderNumbers, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add multiple annotations - /// POST api/NumberedAnnotations/poem/{poemId} - /// - public Fonlow.PoemsApp.Data.Client.NumberedAnnotation[] AddMuitiple(System.Guid poemId, int[] orderNumbers, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/poem/"+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(orderNumbers, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update the orders of numbered annotations in a transaction - /// PUT api/NumberedAnnotations/BulkOrderNumbers - /// - public async Task BulkUpdateOrderNumbersAsync(System.Tuple[] idAndOrderArray, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/BulkOrderNumbers"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(idAndOrderArray, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update the orders of numbered annotations in a transaction - /// PUT api/NumberedAnnotations/BulkOrderNumbers - /// - public void BulkUpdateOrderNumbers(System.Tuple[] idAndOrderArray, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/BulkOrderNumbers"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(idAndOrderArray, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemNumberedAnnotationMap. - /// DELETE api/NumberedAnnotations?id={id} - /// - public async Task DeleteAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemNumberedAnnotationMap. - /// DELETE api/NumberedAnnotations?id={id} - /// - public bool Delete(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get numberedAnnotation. Support ZH Convert. - /// GET api/NumberedAnnotations?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get numberedAnnotation. Support ZH Convert. - /// GET api/NumberedAnnotations?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.NumberedAnnotation Get(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update annotation - /// PUT api/NumberedAnnotations - /// - public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.NumberedAnnotation numberedAnnotation, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(numberedAnnotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update annotation - /// PUT api/NumberedAnnotations - /// - public void Update(Fonlow.PoemsApp.Data.Client.NumberedAnnotation numberedAnnotation, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(numberedAnnotation, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update Order Number - /// PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - /// - public async Task UpdateOrderNumberAsync(System.Guid id, int orderNumber, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/OrderNumber?id="+id+"&orderNumber="+orderNumber; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update Order Number - /// PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - /// - public void UpdateOrderNumber(System.Guid id, int orderNumber, Action handleHeaders = null) - { - var requestUri = "api/NumberedAnnotations/OrderNumber?id="+id+"&orderNumber="+orderNumber; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - } - - /// - /// Poems operations; associations with tags, albums and annotations. - /// - public partial class Poems - { - - private System.Net.Http.HttpClient client; - - private JsonSerializerOptions jsonSerializerSettings; - - public Poems(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) - { - if (client == null) - throw new ArgumentNullException(nameof(client), "Null HttpClient."); - - if (client.BaseAddress == null) - throw new ArgumentNullException(nameof(client), "HttpClient has no BaseAddress"); - - this.client = client; - this.jsonSerializerSettings = jsonSerializerSettings; - } - - /// - /// Add poem. If created is undefined, it will be now. And modified is always now. - /// POST api/Poems - /// - /// Id of newly added - public async Task AddAsync(Fonlow.PoemsApp.Data.Client.Poem poem, Action handleHeaders = null) - { - var requestUri = "api/Poems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poem, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add poem. If created is undefined, it will be now. And modified is always now. - /// POST api/Poems - /// - /// Id of newly added - public Fonlow.PoemsApp.Data.Client.Poem Add(Fonlow.PoemsApp.Data.Client.Poem poem, Action handleHeaders = null) - { - var requestUri = "api/Poems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poem, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add new poem with existing annotations and new annotation names. - /// PUT api/Poems/AddWithExistingAnnotations - /// - /// new poem, existing Annotation Ids, and new annotation names - /// Poem Id and new annotation objects - public async Task AddWithExistingAnnotationsAsync(System.Tuple poemAndAnnotations, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithExistingAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndAnnotations, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add new poem with existing annotations and new annotation names. - /// PUT api/Poems/AddWithExistingAnnotations - /// - /// new poem, existing Annotation Ids, and new annotation names - /// Poem Id and new annotation objects - public Fonlow.PoemsApp.Data.Client.Poem AddWithExistingAnnotations(System.Tuple poemAndAnnotations, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithExistingAnnotations"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndAnnotations, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Poem with Tags - /// POST api/Poems/addWithExistingTags - /// - public async Task AddWithExistingTagsAsync(System.Tuple poemAndTags, Action handleHeaders = null) - { - var requestUri = "api/Poems/addWithExistingTags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndTags, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Poem with Tags - /// POST api/Poems/addWithExistingTags - /// - public Fonlow.PoemsApp.Data.Client.Poem AddWithExistingTags(System.Tuple poemAndTags, Action handleHeaders = null) - { - var requestUri = "api/Poems/addWithExistingTags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndTags, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Poems/AddWithNewAnnotationNames - /// - public async Task AddWithNewAnnotationNamesAsync(System.Tuple poemAndAnnotations, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithNewAnnotationNames"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndAnnotations, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Poems/AddWithNewAnnotationNames - /// - public Fonlow.PoemsApp.Data.Client.Poem AddWithNewAnnotationNames(System.Tuple poemAndAnnotations, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithNewAnnotationNames"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndAnnotations, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add new poem with existing tags, and new tag names. - /// POST api/Poems/AddWithNewTagNames - /// - /// new poem, existing Tag Ids, and new tag names - /// Poem Id and new tag objects - public async Task AddWithNewTagNamesAsync(System.Tuple poemAndNewTags, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithNewTagNames"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndNewTags, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Add new poem with existing tags, and new tag names. - /// POST api/Poems/AddWithNewTagNames - /// - /// new poem, existing Tag Ids, and new tag names - /// Poem Id and new tag objects - public Fonlow.PoemsApp.Data.Client.Poem AddWithNewTagNames(System.Tuple poemAndNewTags, Action handleHeaders = null) - { - var requestUri = "api/Poems/AddWithNewTagNames"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(poemAndNewTags, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate album with existing poems. - /// PUT api/Poems/poemsToAlbum?albumId={albumId} - /// - public async Task AssociateAlbumWithPoemsAsync(System.Guid albumId, System.Guid[] poemIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/poemsToAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate album with existing poems. - /// PUT api/Poems/poemsToAlbum?albumId={albumId} - /// - public void AssociateAlbumWithPoems(System.Guid albumId, System.Guid[] poemIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/poemsToAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poemIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing albums. - /// PUT api/Poems/albums?poemId={poemId} - /// - public async Task AssociateWithAlbumsAsync(System.Guid poemId, System.Guid[] albumIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/albums?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(albumIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing albums. - /// PUT api/Poems/albums?poemId={poemId} - /// - public void AssociateWithAlbums(System.Guid poemId, System.Guid[] albumIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/albums?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(albumIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing annotations. - /// PUT api/Poems/existingAnnotations?poemId={poemId} - /// - public async Task AssociateWithExistingAnnotationsAsync(System.Guid poemId, System.Guid[] existingAnnotationIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/existingAnnotations?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(existingAnnotationIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing annotations. - /// PUT api/Poems/existingAnnotations?poemId={poemId} - /// - public void AssociateWithExistingAnnotations(System.Guid poemId, System.Guid[] existingAnnotationIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/existingAnnotations?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(existingAnnotationIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing tags. - /// PUT api/Poems/existingTags?poemId={poemId} - /// - public async Task AssociateWithExistingTagsAsync(System.Guid poemId, System.Guid[] existingTagIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/existingTags?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(existingTagIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate with existing tags. - /// PUT api/Poems/existingTags?poemId={poemId} - /// - public void AssociateWithExistingTags(System.Guid poemId, System.Guid[] existingTagIds, Action handleHeaders = null) - { - var requestUri = "api/Poems/existingTags?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(existingTagIds, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Save the new annotation, and associate with the poem. - /// If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - /// PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - /// - /// New annotation, or null if the annotation exists - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task AssociateWithNewAnnotationNameAsync(System.Guid poemId, string newAnnotationName, Action handleHeaders = null) - { - var requestUri = "api/Poems/newAnnotationName?poemId="+poemId+"&newAnnotationName="+(newAnnotationName == null ? "" : Uri.EscapeDataString(newAnnotationName)); - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Save the new annotation, and associate with the poem. - /// If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - /// PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - /// - /// New annotation, or null if the annotation exists - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.AnnotationBrief AssociateWithNewAnnotationName(System.Guid poemId, string newAnnotationName, Action handleHeaders = null) - { - var requestUri = "api/Poems/newAnnotationName?poemId="+poemId+"&newAnnotationName="+(newAnnotationName == null ? "" : Uri.EscapeDataString(newAnnotationName)); - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate poem with new tag names. - /// PUT api/Poems/newAnnotationNames?poemId={poemId} - /// - /// New annotation objects based on newAnnotationNames - public async Task AssociateWithNewAnnotationNamesAsync(System.Guid poemId, string[] newAnnotationNames, Action handleHeaders = null) - { - var requestUri = "api/Poems/newAnnotationNames?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(newAnnotationNames, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate poem with new tag names. - /// PUT api/Poems/newAnnotationNames?poemId={poemId} - /// - /// New annotation objects based on newAnnotationNames - public Fonlow.PoemsApp.Data.Client.AnnotationBrief[] AssociateWithNewAnnotationNames(System.Guid poemId, string[] newAnnotationNames, Action handleHeaders = null) - { - var requestUri = "api/Poems/newAnnotationNames?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(newAnnotationNames, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Save the new tag, and associate with the poem. - /// If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - /// PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - /// - /// New tag, or null if the tag exists - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task AssociateWithNewTagNameAsync(System.Guid poemId, string newTagName, Action handleHeaders = null) - { - var requestUri = "api/Poems/newTagName?poemId="+poemId+"&newTagName="+(newTagName == null ? "" : Uri.EscapeDataString(newTagName)); - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Save the new tag, and associate with the poem. - /// If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - /// PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - /// - /// New tag, or null if the tag exists - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.Tag AssociateWithNewTagName(System.Guid poemId, string newTagName, Action handleHeaders = null) - { - var requestUri = "api/Poems/newTagName?poemId="+poemId+"&newTagName="+(newTagName == null ? "" : Uri.EscapeDataString(newTagName)); - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate poem with new tag names. - /// PUT api/Poems/newTagNames?poemId={poemId} - /// - /// New tag objects based on newTagNames - public async Task AssociateWithNewTagNamesAsync(System.Guid poemId, string[] newTagNames, Action handleHeaders = null) - { - var requestUri = "api/Poems/newTagNames?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(newTagNames, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Associate poem with new tag names. - /// PUT api/Poems/newTagNames?poemId={poemId} - /// - /// New tag objects based on newTagNames - public Fonlow.PoemsApp.Data.Client.Tag[] AssociateWithNewTagNames(System.Guid poemId, string[] newTagNames, Action handleHeaders = null) - { - var requestUri = "api/Poems/newTagNames?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(newTagNames, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Reconcile among all images, poemImageMaps, and actually img local - /// POST api/Poems/AuditAndReconcile - /// - public async Task AuditAndReconcileAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/AuditAndReconcile"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Reconcile among all images, poemImageMaps, and actually img local - /// POST api/Poems/AuditAndReconcile - /// - public int AuditAndReconcile(Action handleHeaders = null) - { - var requestUri = "api/Poems/AuditAndReconcile"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// DELETE api/Poems/all - /// - public async Task ClearAllTablesAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// DELETE api/Poems/all - /// - public void ClearAllTables(Action handleHeaders = null) - { - var requestUri = "api/Poems/all"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - /// DELETE api/Poems?id={id} - /// - public async Task DeleteAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Poems?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - /// DELETE api/Poems?id={id} - /// - public bool Delete(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Poems?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Dissociate album. - /// DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - /// - public async Task DissociateAlbumAsync(System.Guid poemId, System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateAlbum?poemId="+poemId+"&albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Dissociate album. - /// DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - /// - public void DissociateAlbum(System.Guid poemId, System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateAlbum?poemId="+poemId+"&albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Disassociate annotation. - /// DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - /// - public async Task DissociateAnnotationAsync(System.Guid poemId, System.Guid annotationId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateAnnotation?poemId="+poemId+"&annotationId="+annotationId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Disassociate annotation. - /// DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - /// - public void DissociateAnnotation(System.Guid poemId, System.Guid annotationId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateAnnotation?poemId="+poemId+"&annotationId="+annotationId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// DissociateT tag. - /// DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - /// - public async Task DissociateTagAsync(System.Guid poemId, System.Guid tagId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateTag?poemId="+poemId+"&tagId="+tagId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// DissociateT tag. - /// DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - /// - public void DissociateTag(System.Guid poemId, System.Guid tagId, Action handleHeaders = null) - { - var requestUri = "api/Poems/DissociateTag?poemId="+poemId+"&tagId="+tagId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - /// PUT api/Poems/EscapeStringToUnicode - /// - public async Task EscapeStringToUnicodeAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/EscapeStringToUnicode"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - /// PUT api/Poems/EscapeStringToUnicode - /// - public void EscapeStringToUnicode(Action handleHeaders = null) - { - var requestUri = "api/Poems/EscapeStringToUnicode"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Include TagMap and AlbumMap. Support ZH Convert. - /// GET api/Poems?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Poems?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Include TagMap and AlbumMap. Support ZH Convert. - /// GET api/Poems?id={id} - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.Poem Get(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Poems?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Img Src Url to multiple poem Ids - /// GET api/Poems/AllNotLocalImagesOfPoems - /// - public async Task> GetAllNotLocalImagesOfPoemsAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/AllNotLocalImagesOfPoems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Img Src Url to multiple poem Ids - /// GET api/Poems/AllNotLocalImagesOfPoems - /// - public System.Collections.Generic.Dictionary GetAllNotLocalImagesOfPoems(Action handleHeaders = null) - { - var requestUri = "api/Poems/AllNotLocalImagesOfPoems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - /// POST api/Poems/AssociatedPoemsOfImages - /// - public async Task> GetAssociatedPoemsOfAllImagesAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/AssociatedPoemsOfImages"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - /// POST api/Poems/AssociatedPoemsOfImages - /// - public System.Collections.Generic.IDictionary GetAssociatedPoemsOfAllImages(Action handleHeaders = null) - { - var requestUri = "api/Poems/AssociatedPoemsOfImages"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - /// GET api/Poems/AllBriefs - /// - /// int in header - public async Task GetBriefsOfPoemsAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/AllBriefs"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - /// GET api/Poems/AllBriefs - /// - /// int in header - public Fonlow.PoemsApp.Data.Client.PoemBrief[] GetBriefsOfPoems(Action handleHeaders = null) - { - var requestUri = "api/Poems/AllBriefs"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// All poems of album, order by published. Support ZH Convert. - /// GET api/Poems/GetOfAlbum?albumId={albumId} - /// - /// string in header - /// int in header - public async Task GetOfAlbumAsync(System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/GetOfAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// All poems of album, order by published. Support ZH Convert. - /// GET api/Poems/GetOfAlbum?albumId={albumId} - /// - /// string in header - /// int in header - public Fonlow.PoemsApp.Data.Client.Poem[] GetOfAlbum(System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/GetOfAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - /// - /// int in header - public async Task GetPoemBriefsOfAlbumAsync(System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/GetPoemBriefsOfAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - /// - /// int in header - public Fonlow.PoemsApp.Data.Client.PoemBrief[] GetPoemBriefsOfAlbum(System.Guid albumId, Action handleHeaders = null) - { - var requestUri = "api/Poems/GetPoemBriefsOfAlbum?albumId="+albumId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollection - /// - public async Task GetPoemCollectionAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollection"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollection - /// - public Fonlow.PoemsApp.Data.Client.PoemCollection GetPoemCollection(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollection"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionInOtherChineseWriting - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetPoemCollectionInOtherChineseWritingAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionInOtherChineseWriting"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionInOtherChineseWriting - /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.PoemCollection GetPoemCollectionInOtherChineseWriting(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionInOtherChineseWriting"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionPublished - /// - /// In request headers - public async Task GetPoemCollectionPublishedAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionPublished"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionPublished - /// - /// In request headers - public Fonlow.PoemsApp.Data.Client.PoemCollection GetPoemCollectionPublished(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionPublished"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - /// - /// timezoneOffset in headers - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetPoemCollectionPublishedInOtherChineseWritingAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionPublishedInOtherChineseWriting"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - /// - /// timezoneOffset in headers - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.PoemCollection GetPoemCollectionPublishedInOtherChineseWriting(Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollectionPublishedInOtherChineseWriting"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - /// - public async Task GetPoemsWithInternalImageIdAsync(System.Guid imageId, Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemsWithInternalImageId?imageId="+imageId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - /// - public Fonlow.PoemsApp.Data.Client.PoemBrief[] GetPoemsWithInternalImageId(System.Guid imageId, Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemsWithInternalImageId?imageId="+imageId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/TotalCountOfStanza - /// - public async Task GetTotalCountOfStanzaAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/TotalCountOfStanza"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/TotalCountOfStanza - /// - public int GetTotalCountOfStanza(Action handleHeaders = null) - { - var requestUri = "api/Poems/TotalCountOfStanza"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Poems/PoemCollection - /// - public async Task ImportPoemCollectionAsync(Fonlow.PoemsApp.Data.Client.PoemCollection collection, Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollection"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(collection, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Poems/PoemCollection - /// - public void ImportPoemCollection(Fonlow.PoemsApp.Data.Client.PoemCollection collection, Action handleHeaders = null) - { - var requestUri = "api/Poems/PoemCollection"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(collection, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/ByAnnotation?annotationId={annotationId} - /// - public async Task SearchByAnnotationAsync(System.Guid annotationId, Action handleHeaders = null) - { - var requestUri = "api/Poems/ByAnnotation?annotationId="+annotationId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// GET api/Poems/ByAnnotation?annotationId={annotationId} - /// - public Fonlow.PoemsApp.Data.Client.PoemBrief[] SearchByAnnotation(System.Guid annotationId, Action handleHeaders = null) - { - var requestUri = "api/Poems/ByAnnotation?annotationId="+annotationId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - /// POST api/Poems/ByKeywords - /// - /// int in header - public async Task SearchByKeywordsAsync(string keywords, Action handleHeaders = null) - { - var requestUri = "api/Poems/ByKeywords"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(keywords, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - /// POST api/Poems/ByKeywords - /// - /// int in header - public Fonlow.PoemsApp.Data.Client.PoemBrief[] SearchByKeywords(string keywords, Action handleHeaders = null) - { - var requestUri = "api/Poems/ByKeywords"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(keywords, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update poem. - /// PUT api/Poems - /// - public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Poem poem, Action handleHeaders = null) - { - var requestUri = "api/Poems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poem, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Update poem. - /// PUT api/Poems - /// - public void Update(Fonlow.PoemsApp.Data.Client.Poem poem, Action handleHeaders = null) - { - var requestUri = "api/Poems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(poem, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Just for maintenance, while the plaintext should be produced in the frontend. - /// POST api/Poems/UpdatePlainTextOfHtmlPoems - /// - public async Task UpdatePlainTextOfHtmlPoemsAsync(Action handleHeaders = null) - { - var requestUri = "api/Poems/UpdatePlainTextOfHtmlPoems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Just for maintenance, while the plaintext should be produced in the frontend. - /// POST api/Poems/UpdatePlainTextOfHtmlPoems - /// - public void UpdatePlainTextOfHtmlPoems(Action handleHeaders = null) - { - var requestUri = "api/Poems/UpdatePlainTextOfHtmlPoems"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Poems/UpdatePublished?poemId={poemId} - /// - public async Task UpdatePublishedAsync(System.Guid poemId, System.Nullable dt, Action handleHeaders = null) - { - var requestUri = "api/Poems/UpdatePublished?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(dt, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// PUT api/Poems/UpdatePublished?poemId={poemId} - /// - public void UpdatePublished(System.Guid poemId, System.Nullable dt, Action handleHeaders = null) - { - var requestUri = "api/Poems/UpdatePublished?poemId="+poemId; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(dt, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - } - finally - { - responseMessage.Dispose(); - } - } - } +namespace DemoCoreWeb.Controllers.Client +{ + using System; + using System.Linq; + using System.Collections.Generic; + using System.Threading.Tasks; + using System.Net.Http; + using System.Text.Json; + using System.Text.Json.Serialization; + using Fonlow.Net.Http; - /// - /// Tags management - /// - public partial class Tags + + public partial class SpecialTypes { private System.Net.Http.HttpClient client; private JsonSerializerOptions jsonSerializerSettings; - public Tags(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) + public SpecialTypes(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSerializerSettings=null) { if (client == null) throw new ArgumentNullException(nameof(client), "Null HttpClient."); @@ -13020,153 +9320,13 @@ public Tags(System.Net.Http.HttpClient client, JsonSerializerOptions jsonSeriali } /// - /// POST api/Tags - /// - public async Task AddAsync(Fonlow.PoemsApp.Data.Client.Tag tag, Action handleHeaders = null) - { - var requestUri = "api/Tags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(tag, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Tags - /// - public System.Guid Add(Fonlow.PoemsApp.Data.Client.Tag tag, Action handleHeaders = null) - { - var requestUri = "api/Tags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(tag, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemTagMap. - /// DELETE api/Tags?id={id} - /// - public async Task DeleteAsync(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Tags?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Delete along with what in poemTagMap. - /// DELETE api/Tags?id={id} - /// - public bool Delete(System.Guid id, Action handleHeaders = null) - { - var requestUri = "api/Tags?id="+id; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, requestUri); - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Tags/Orphaned - /// - public async Task DeleteOrphanedAsync(System.Guid[] ids, Action handleHeaders = null) - { - var requestUri = "api/Tags/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(ids, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = await client.SendAsync(httpRequestMessage); - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// POST api/Tags/Orphaned - /// - public int DeleteOrphaned(System.Guid[] ids, Action handleHeaders = null) - { - var requestUri = "api/Tags/Orphaned"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); - var contentJson = JsonSerializer.Serialize(ids, jsonSerializerSettings); - var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); - httpRequestMessage.Content = content; - handleHeaders?.Invoke(httpRequestMessage.Headers); - var responseMessage = client.SendAsync(httpRequestMessage).Result; - try - { - responseMessage.EnsureSuccessStatusCodeEx(); - var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); - } - finally - { - responseMessage.Dispose(); - } - } - - /// - /// Get tag. Support ZH Convert. - /// GET api/Tags?id={id} + /// Anonymous Dynamic of C# + /// GET api/SpecialTypes/AnonymousDynamic /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public async Task GetAsync(System.Guid id, Action handleHeaders = null) + /// dyanmic things + public async Task GetAnonymousDynamicAsync(Action handleHeaders = null) { - var requestUri = "api/Tags?id="+id; + var requestUri = "api/SpecialTypes/AnonymousDynamic"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = await client.SendAsync(httpRequestMessage); @@ -13175,7 +9335,7 @@ public async Task GetAsync(System.Guid id, Acti responseMessage.EnsureSuccessStatusCodeEx(); if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13184,13 +9344,13 @@ public async Task GetAsync(System.Guid id, Acti } /// - /// Get tag. Support ZH Convert. - /// GET api/Tags?id={id} + /// Anonymous Dynamic of C# + /// GET api/SpecialTypes/AnonymousDynamic /// - [return: System.Diagnostics.CodeAnalysis.MaybeNullAttribute()] - public Fonlow.PoemsApp.Data.Client.Tag Get(System.Guid id, Action handleHeaders = null) + /// dyanmic things + public System.Text.Json.Nodes.JsonObject GetAnonymousDynamic(Action handleHeaders = null) { - var requestUri = "api/Tags?id="+id; + var requestUri = "api/SpecialTypes/AnonymousDynamic"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = client.SendAsync(httpRequestMessage).Result; @@ -13199,7 +9359,7 @@ public Fonlow.PoemsApp.Data.Client.Tag Get(System.Guid id, Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13208,12 +9368,12 @@ public Fonlow.PoemsApp.Data.Client.Tag Get(System.Guid id, Action - /// Get all tags. Support ZH Convert. - /// GET api/Tags/all + /// Async function returing dynamic + /// GET api/SpecialTypes/AnonymousDynamic2 /// - public async Task GetAllAsync(Action handleHeaders = null) + public async Task GetAnonymousDynamic2Async(Action handleHeaders = null) { - var requestUri = "api/Tags/all"; + var requestUri = "api/SpecialTypes/AnonymousDynamic2"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = await client.SendAsync(httpRequestMessage); @@ -13222,7 +9382,7 @@ public async Task GetAllAsync(Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13231,12 +9391,12 @@ public async Task GetAllAsync(Action - /// Get all tags. Support ZH Convert. - /// GET api/Tags/all + /// Async function returing dynamic + /// GET api/SpecialTypes/AnonymousDynamic2 /// - public Fonlow.PoemsApp.Data.Client.Tag[] GetAll(Action handleHeaders = null) + public System.Text.Json.Nodes.JsonObject GetAnonymousDynamic2(Action handleHeaders = null) { - var requestUri = "api/Tags/all"; + var requestUri = "api/SpecialTypes/AnonymousDynamic2"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = client.SendAsync(httpRequestMessage).Result; @@ -13245,7 +9405,7 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetAll(Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13254,20 +9414,20 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetAll(Action - /// Get all tags as dictionary. Support ZH Convert. - /// GET api/Tags/allDic + /// GET api/SpecialTypes/AnonymousObject /// - public async Task> GetAllDicAsync(Action handleHeaders = null) + public async Task GetAnonymousObjectAsync(Action handleHeaders = null) { - var requestUri = "api/Tags/allDic"; + var requestUri = "api/SpecialTypes/AnonymousObject"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = await client.SendAsync(httpRequestMessage); try { responseMessage.EnsureSuccessStatusCodeEx(); + if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13276,20 +9436,20 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetAll(Action - /// Get all tags as dictionary. Support ZH Convert. - /// GET api/Tags/allDic + /// GET api/SpecialTypes/AnonymousObject /// - public System.Collections.Generic.IDictionary GetAllDic(Action handleHeaders = null) + public System.Text.Json.Nodes.JsonObject GetAnonymousObject(Action handleHeaders = null) { - var requestUri = "api/Tags/allDic"; + var requestUri = "api/SpecialTypes/AnonymousObject"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = client.SendAsync(httpRequestMessage).Result; try { responseMessage.EnsureSuccessStatusCodeEx(); + if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } var contentString = responseMessage.Content.ReadAsStringAsync().Result; - return JsonSerializer.Deserialize>(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13298,11 +9458,12 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetAll(Action - /// GET api/Tags/Orphaned + /// Async function returning object + /// GET api/SpecialTypes/AnonymousObject2 /// - public async Task GetOrphanedAsync(Action handleHeaders = null) + public async Task GetAnonymousObject2Async(Action handleHeaders = null) { - var requestUri = "api/Tags/Orphaned"; + var requestUri = "api/SpecialTypes/AnonymousObject2"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = await client.SendAsync(httpRequestMessage); @@ -13311,7 +9472,7 @@ public async Task GetOrphanedAsync(Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13320,11 +9481,12 @@ public async Task GetOrphanedAsync(Action - /// GET api/Tags/Orphaned + /// Async function returning object + /// GET api/SpecialTypes/AnonymousObject2 /// - public Fonlow.PoemsApp.Data.Client.Tag[] GetOrphaned(Action handleHeaders = null) + public System.Text.Json.Nodes.JsonObject GetAnonymousObject2(Action handleHeaders = null) { - var requestUri = "api/Tags/Orphaned"; + var requestUri = "api/SpecialTypes/AnonymousObject2"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = client.SendAsync(httpRequestMessage).Result; @@ -13333,7 +9495,7 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetOrphaned(Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13342,12 +9504,15 @@ public Fonlow.PoemsApp.Data.Client.Tag[] GetOrphaned(Action - /// GET api/Tags/PoemCountOfTags + /// POST api/SpecialTypes/AnonymousObject /// - public async Task GetPoemCountOfTagsAsync(Action handleHeaders = null) + public async Task PostAnonymousObjectAsync(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) { - var requestUri = "api/Tags/PoemCountOfTags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); + var requestUri = "api/SpecialTypes/AnonymousObject"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); + var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); + var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); + httpRequestMessage.Content = content; handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = await client.SendAsync(httpRequestMessage); try @@ -13355,7 +9520,7 @@ public async Task GetPoemCountOfTags responseMessage.EnsureSuccessStatusCodeEx(); if (responseMessage.StatusCode == System.Net.HttpStatusCode.NoContent) { return null; } var contentString = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13364,12 +9529,15 @@ public async Task GetPoemCountOfTags } /// - /// GET api/Tags/PoemCountOfTags + /// POST api/SpecialTypes/AnonymousObject /// - public Fonlow.PoemsApp.Data.Client.TagPoemCount[] GetPoemCountOfTags(Action handleHeaders = null) + public System.Text.Json.Nodes.JsonObject PostAnonymousObject(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) { - var requestUri = "api/Tags/PoemCountOfTags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri); + var requestUri = "api/SpecialTypes/AnonymousObject"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); + var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); + var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); + httpRequestMessage.Content = content; handleHeaders?.Invoke(httpRequestMessage.Headers); var responseMessage = client.SendAsync(httpRequestMessage).Result; try @@ -13377,7 +9545,7 @@ public Fonlow.PoemsApp.Data.Client.TagPoemCount[] GetPoemCountOfTags(Action(contentString, jsonSerializerSettings); + return JsonSerializer.Deserialize(contentString, jsonSerializerSettings); } finally { @@ -13386,13 +9554,14 @@ public Fonlow.PoemsApp.Data.Client.TagPoemCount[] GetPoemCountOfTags(Action - /// PUT api/Tags + /// Async returning object, Post dynamic + /// POST api/SpecialTypes/AnonymousObject2 /// - public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Tag tag, Action handleHeaders = null) + public async Task PostAnonymousObject2Async(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) { - var requestUri = "api/Tags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(tag, jsonSerializerSettings); + var requestUri = "api/SpecialTypes/AnonymousObject2"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); + var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); httpRequestMessage.Content = content; handleHeaders?.Invoke(httpRequestMessage.Headers); @@ -13400,6 +9569,9 @@ public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Tag tag, Action(contentString, jsonSerializerSettings); } finally { @@ -13408,13 +9580,14 @@ public async Task UpdateAsync(Fonlow.PoemsApp.Data.Client.Tag tag, Action - /// PUT api/Tags + /// Async returning object, Post dynamic + /// POST api/SpecialTypes/AnonymousObject2 /// - public void Update(Fonlow.PoemsApp.Data.Client.Tag tag, Action handleHeaders = null) + public System.Text.Json.Nodes.JsonObject PostAnonymousObject2(System.Text.Json.Nodes.JsonObject obj, Action handleHeaders = null) { - var requestUri = "api/Tags"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, requestUri); - var contentJson = JsonSerializer.Serialize(tag, jsonSerializerSettings); + var requestUri = "api/SpecialTypes/AnonymousObject2"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri); + var contentJson = JsonSerializer.Serialize(obj, jsonSerializerSettings); var content = new StringContent(contentJson, System.Text.Encoding.UTF8, "application/json"); httpRequestMessage.Content = content; handleHeaders?.Invoke(httpRequestMessage.Headers); @@ -13422,6 +9595,9 @@ public void Update(Fonlow.PoemsApp.Data.Client.Tag tag, Action(contentString, jsonSerializerSettings); } finally { diff --git a/DemoTextJsonWeb/Properties/launchSettings.json b/DemoTextJsonWeb/Properties/launchSettings.json index bc45b1c2..290efd0f 100644 --- a/DemoTextJsonWeb/Properties/launchSettings.json +++ b/DemoTextJsonWeb/Properties/launchSettings.json @@ -14,7 +14,7 @@ "dotnetRunMessages": true, "launchBrowser": false, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5000", + "applicationUrl": "http://localhost:6000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -24,11 +24,22 @@ "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "https://localhost:7123;http://localhost:5017", + "applicationUrl": "https://localhost:6001", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "CodeGen": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, + "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, diff --git a/DemoTextJsonWeb/appsettings.json b/DemoTextJsonWeb/appsettings.json index bc91c87f..55cab371 100644 --- a/DemoTextJsonWeb/appsettings.json +++ b/DemoTextJsonWeb/appsettings.json @@ -17,20 +17,6 @@ } }, - "AllowedHosts": "*", - - "Kestrel": { - "EndPoints": { - "Http": { - "Url": "http://localhost:6000" - }, - - "HttpsDefaultCert": { - "Url": "https://localhost:6001" - } - - } - - } + "AllowedHosts": "*" } diff --git a/HeroesDemo/src/clientapi/WebApiCoreNG2FormGroupClientAuto.ts b/HeroesDemo/src/clientapi/WebApiCoreNG2FormGroupClientAuto.ts index 2a19ec6e..c6c7affc 100644 --- a/HeroesDemo/src/clientapi/WebApiCoreNG2FormGroupClientAuto.ts +++ b/HeroesDemo/src/clientapi/WebApiCoreNG2FormGroupClientAuto.ts @@ -2414,1422 +2414,57 @@ export namespace DemoWebApi_Models_Client { } -export namespace Fonlow_PoemsApp_Data_Client { - export interface Album { - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published?: Date | null; - - /** - * First published Url - */ - publishedUrl?: string | null; - - /** - * Album title should never be changed. - */ - title?: string | null; - } - export interface AlbumFormProperties { - bodyType: FormControl, - description: FormControl, - - /** Type: GUID */ - id: FormControl, - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published: FormControl, - - /** - * First published Url - */ - publishedUrl: FormControl, - - /** - * Album title should never be changed. - */ - title: FormControl, - } - export function CreateAlbumFormGroup() { - return new FormGroup({ - bodyType: new FormControl(undefined), - description: new FormControl(undefined), - id: new FormControl(undefined), - published: new FormControl(undefined), - publishedUrl: new FormControl(undefined), - title: new FormControl(undefined), - }); - - } - - export interface Annotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** */ - name?: string | null; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - export interface AnnotationFormProperties { - - /** - * HTML description - */ - description: FormControl, - - /** Type: GUID */ - id: FormControl, - - /** */ - name: FormControl, - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url: FormControl, - } - export function CreateAnnotationFormGroup() { - return new FormGroup({ - description: new FormControl(undefined), - id: new FormControl(undefined), - name: new FormControl(undefined), - url: new FormControl(undefined), - }); - - } - - export interface AnnotationBrief { - - /** - * Count of poems associated - */ - count?: number | null; - - /** Type: GUID */ - id: string; - name: string; - } - export interface AnnotationBriefFormProperties { - - /** - * Count of poems associated - */ - count: FormControl, - - /** Type: GUID */ - id: FormControl, - name: FormControl, - } - export function CreateAnnotationBriefFormGroup() { - return new FormGroup({ - count: new FormControl(undefined), - id: new FormControl(undefined), - name: new FormControl(undefined), - }); - - } - - export interface AnnotationPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - export interface AnnotationPoemCountFormProperties extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCountFormProperties { - } - export function CreateAnnotationPoemCountFormGroup() { - return new FormGroup({ - count: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - id: new FormControl(undefined), - }); - - } - - export enum BodyType { Text, HTML, MD } - - export interface ExternalImageMap { - description?: string | null; - name?: string | null; - poemIds?: Array; - srcUrl?: string | null; - } - export interface ExternalImageMapFormProperties { - description: FormControl, - name: FormControl, - srcUrl: FormControl, - } - export function CreateExternalImageMapFormGroup() { - return new FormGroup({ - description: new FormControl(undefined), - name: new FormControl(undefined), - srcUrl: new FormControl(undefined), - }); - - } - - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCode { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code?: string | null; - display?: string | null; - } - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCodeFormProperties { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code: FormControl, - display: FormControl, - } - export function CreateLanguageCodeFormGroup() { - return new FormGroup({ - code: new FormControl(undefined), - display: new FormControl(undefined), - }); - - } - - export interface LoginModel { - emailAddress?: string | null; - firstName?: string | null; - idToken?: string | null; - lastName?: string | null; - name?: string | null; - pictureUrl?: string | null; - provider?: string | null; - userId?: string | null; - } - export interface LoginModelFormProperties { - emailAddress: FormControl, - firstName: FormControl, - idToken: FormControl, - lastName: FormControl, - name: FormControl, - pictureUrl: FormControl, - provider: FormControl, - userId: FormControl, - } - export function CreateLoginModelFormGroup() { - return new FormGroup({ - emailAddress: new FormControl(undefined), - firstName: new FormControl(undefined), - idToken: new FormControl(undefined), - lastName: new FormControl(undefined), - name: new FormControl(undefined), - pictureUrl: new FormControl(undefined), - provider: new FormControl(undefined), - userId: new FormControl(undefined), - }); - - } - - export interface MetaData { - key?: string | null; - value?: string | null; - } - export interface MetaDataFormProperties { - key: FormControl, - value: FormControl, - } - export function CreateMetaDataFormGroup() { - return new FormGroup({ - key: new FormControl(undefined), - value: new FormControl(undefined), - }); - - } - - export interface MetaDataPoemCount { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count?: number | null; - - /** Type: GUID */ - id: string; - } - export interface MetaDataPoemCountFormProperties { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count: FormControl, - - /** Type: GUID */ - id: FormControl, - } - export function CreateMetaDataPoemCountFormGroup() { - return new FormGroup({ - count: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - id: new FormControl(undefined), - }); - - } - - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: number; - - /** */ - poemId: string; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotationFormProperties { - - /** - * HTML description - */ - description: FormControl, - - /** Type: GUID */ - id: FormControl, - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: FormControl, - - /** */ - poemId: FormControl, - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url: FormControl, - } - export function CreateNumberedAnnotationFormGroup() { - return new FormGroup({ - description: new FormControl(undefined), - id: new FormControl(undefined), - orderNumber: new FormControl(undefined, [Validators.min(1), Validators.max(2147483647)]), - poemId: new FormControl(undefined), - url: new FormControl(undefined), - }); - - } - - export interface NumberedAnnotationBrief { - - /** Type: GUID */ - id: string; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: number; - } - export interface NumberedAnnotationBriefFormProperties { - - /** Type: GUID */ - id: FormControl, - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: FormControl, - } - export function CreateNumberedAnnotationBriefFormGroup() { - return new FormGroup({ - id: new FormControl(undefined), - orderNumber: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - }); - - } - - export interface Picture extends Fonlow_PoemsApp_Data_Client.PictureMeta { - content?: Array; - } - export interface PictureFormProperties extends Fonlow_PoemsApp_Data_Client.PictureMetaFormProperties { - } - export function CreatePictureFormGroup() { - return new FormGroup({ - contentType: new FormControl(undefined), - description: new FormControl(undefined, [Validators.maxLength(512)]), - id: new FormControl(undefined), - name: new FormControl(undefined, [Validators.maxLength(128)]), - }); - - } - - export interface PictureMeta { - contentType?: string | null; - - /** Max length: 512 */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** Max length: 128 */ - name?: string | null; - } - export interface PictureMetaFormProperties { - contentType: FormControl, - - /** Max length: 512 */ - description: FormControl, - - /** Type: GUID */ - id: FormControl, - - /** Max length: 128 */ - name: FormControl, - } - export function CreatePictureMetaFormGroup() { - return new FormGroup({ - contentType: new FormControl(undefined), - description: new FormControl(undefined, [Validators.maxLength(512)]), - id: new FormControl(undefined), - name: new FormControl(undefined, [Validators.maxLength(128)]), - }); - - } - - export interface PicturePoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - poemIds?: Array; - } - export interface PicturePoemCountFormProperties extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCountFormProperties { - } - export function CreatePicturePoemCountFormGroup() { - return new FormGroup({ - count: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - id: new FormControl(undefined), - }); - - } - - export interface Poem { - - /** - * A poem may be included in multipe albums. - * UI may use this to present albums - */ - albumIds?: Array; - annotationIds?: Array; - body?: string | null; - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain?: string | null; - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - - /** - * Author should be able to alter. The default is the created time. - */ - created?: Date | null; - - /** Type: GUID */ - id?: string | null; - modified?: Date | null; - numberedAnnotationBriefs?: Array; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza?: number | null; - pictureIds?: Array; - - /** - * to distinguish draft or published. DateTime. - */ - published?: Date | null; - - /** - * Initial published URL. - */ - publishedUrl?: string | null; - ryhmesCsv?: string | null; - - /** - * UI use this to represent tags. This is not included n DB. - */ - tagIds?: Array; - title?: string | null; - } - export interface PoemFormProperties { - body: FormControl, - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain: FormControl, - bodyType: FormControl, - - /** - * Author should be able to alter. The default is the created time. - */ - created: FormControl, - - /** Type: GUID */ - id: FormControl, - modified: FormControl, - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza: FormControl, - - /** - * to distinguish draft or published. DateTime. - */ - published: FormControl, - - /** - * Initial published URL. - */ - publishedUrl: FormControl, - ryhmesCsv: FormControl, - title: FormControl, - } - export function CreatePoemFormGroup() { - return new FormGroup({ - body: new FormControl(undefined), - bodyPlain: new FormControl(undefined), - bodyType: new FormControl(undefined), - created: new FormControl(undefined), - id: new FormControl(undefined), - modified: new FormControl(undefined), - numberOfStanza: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - published: new FormControl(undefined), - publishedUrl: new FormControl(undefined), - ryhmesCsv: new FormControl(undefined), - title: new FormControl(undefined), - }); - - } - - export interface PoemAlbumMap { - - /** Type: GUID */ - albumId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - export interface PoemAlbumMapFormProperties { - - /** Type: GUID */ - albumId: FormControl, - - /** Type: GUID */ - poemId: FormControl, - } - export function CreatePoemAlbumMapFormGroup() { - return new FormGroup({ - albumId: new FormControl(undefined), - poemId: new FormControl(undefined), - }); - - } - - export interface PoemAnnotationMap { - - /** Type: GUID */ - annotationId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - export interface PoemAnnotationMapFormProperties { - - /** Type: GUID */ - annotationId: FormControl, - - /** Type: GUID */ - poemId: FormControl, - } - export function CreatePoemAnnotationMapFormGroup() { - return new FormGroup({ - annotationId: new FormControl(undefined), - poemId: new FormControl(undefined), - }); - - } - - export interface PoemBrief { - date: Date; - - /** Type: GUID */ - id: string; - published?: Date | null; - tagIds?: Array; - title: string; - } - export interface PoemBriefFormProperties { - date: FormControl, - - /** Type: GUID */ - id: FormControl, - published: FormControl, - title: FormControl, - } - export function CreatePoemBriefFormGroup() { - return new FormGroup({ - date: new FormControl(undefined), - id: new FormControl(undefined), - published: new FormControl(undefined), - title: new FormControl(undefined), - }); - - } - - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollection { - albumMaps: Array; - albums: Array; - annotationMaps: Array; - annotations: Array; - keyValues: Array; - numberedAnnotations: Array; - pictureMaps?: Array; - pictureMetas?: Array; - poems: Array; - tagMaps: Array; - tags: Array; - } - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollectionFormProperties { - } - export function CreatePoemCollectionFormGroup() { - return new FormGroup({ - }); - - } - - export interface PoemPictureMap { - - /** Type: GUID */ - pictureId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - export interface PoemPictureMapFormProperties { - - /** Type: GUID */ - pictureId: FormControl, - - /** Type: GUID */ - poemId: FormControl, - } - export function CreatePoemPictureMapFormGroup() { - return new FormGroup({ - pictureId: new FormControl(undefined), - poemId: new FormControl(undefined), - }); - - } - - export interface PoemTagMap { - - /** Type: GUID */ - poemId?: string | null; - - /** Type: GUID */ - tagId?: string | null; - } - export interface PoemTagMapFormProperties { - - /** Type: GUID */ - poemId: FormControl, - - /** Type: GUID */ - tagId: FormControl, - } - export function CreatePoemTagMapFormGroup() { - return new FormGroup({ - poemId: new FormControl(undefined), - tagId: new FormControl(undefined), - }); - - } - - export interface Tag { - - /** Type: GUID */ - id?: string | null; - name?: string | null; - } - export interface TagFormProperties { - - /** Type: GUID */ - id: FormControl, - name: FormControl, - } - export function CreateTagFormGroup() { - return new FormGroup({ - id: new FormControl(undefined), - name: new FormControl(undefined), - }); - - } - - export interface TagPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - export interface TagPoemCountFormProperties extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCountFormProperties { - } - export function CreateTagPoemCountFormGroup() { - return new FormGroup({ - count: new FormControl(undefined, [Validators.min(-2147483648), Validators.max(2147483647)]), - id: new FormControl(undefined), - }); - - } - -} - -export namespace DemoCoreWeb_Controllers_Client { - @Injectable() - export class SpecialTypes { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * Anonymous Dynamic of C# - * GET api/SpecialTypes/AnonymousDynamic - * @return {any} dyanmic things - */ - getAnonymousDynamic(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Async function returing dynamic - * GET api/SpecialTypes/AnonymousDynamic2 - */ - getAnonymousDynamic2(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic2', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * GET api/SpecialTypes/AnonymousObject - */ - getAnonymousObject(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousObject', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Async function returning object - * GET api/SpecialTypes/AnonymousObject2 - */ - getAnonymousObject2(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousObject2', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * POST api/SpecialTypes/AnonymousObject - */ - postAnonymousObject(obj?: any, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/SpecialTypes/AnonymousObject', JSON.stringify(obj), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Async returning object, Post dynamic - * POST api/SpecialTypes/AnonymousObject2 - */ - postAnonymousObject2(obj?: any, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/SpecialTypes/AnonymousObject2', JSON.stringify(obj), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - -} - -export namespace PoemsApp_Controllers_Client { - - /** - * Album specific operations - */ - @Injectable() - export class Albums { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * Add album. If publisheDate is not defined, it will be now. - * POST api/Albums - */ - add(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemAlbumMap. - * DELETE api/Albums?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get Album. Support ZH Convert. - * GET api/Albums?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all albums. Support ZH Convert. - * GET api/Albums/all - * @param {number} timezoneOffset int in header - */ - getAll(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Albums/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all albums as dictionary. Support ZH Convert. - * GET api/Albums/allDic - * @param {number} timezoneOffset int in header - */ - getAllDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }>(this.baseUri + 'api/Albums/allDic', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Albums - */ - update(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - @Injectable() - export class Annotations { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * POST api/Annotations - * @return {string} Type: GUID - */ - add(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemAnnotationMap. - * DELETE api/Annotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Annotations/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Annotations/Orphaned', JSON.stringify(ids), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Get annotation. Support ZH Convert. - * GET api/Annotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/all - */ - getAnnotationBriefs(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all annotation briefs. Support ZH Convert. - * GET api/Annotations/allDic - */ - getAnnotationBriefsDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }>(this.baseUri + 'api/Annotations/allDic', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/Orphaned - */ - getOrphaned(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/Orphaned', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/PoemCountOfAnnotations - */ - getPoemCountOfAnnotations(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/PoemCountOfAnnotations', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Annotations - */ - update(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - @Injectable() - export class NumberedAnnotations { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * POST api/NumberedAnnotations - * @return {string} Type: GUID - */ - add(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add multiple annotations - * POST api/NumberedAnnotations/poem/{poemId} - * @param {string} poemId Type: GUID - */ - addMuitiple(poemId?: string | null, orderNumbers?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post>(this.baseUri + 'api/NumberedAnnotations/poem/' + poemId, JSON.stringify(orderNumbers), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Update the orders of numbered annotations in a transaction - * PUT api/NumberedAnnotations/BulkOrderNumbers - */ - bulkUpdateOrderNumbers(idAndOrderArray?: Array<{item1: string, item2: number}> | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations/BulkOrderNumbers', JSON.stringify(idAndOrderArray), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Delete along with what in poemNumberedAnnotationMap. - * DELETE api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get numberedAnnotation. Support ZH Convert. - * GET api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Update annotation - * PUT api/NumberedAnnotations - */ - update(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Update Order Number - * PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - * @param {string} id Type: GUID - * @param {number} orderNumber Type: int, -2,147,483,648 to 2,147,483,647 - */ - updateOrderNumber(id?: string | null, orderNumber?: number | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations/OrderNumber?id=' + id + '&orderNumber=' + orderNumber, null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - } - - - /** - * Poems operations; associations with tags, albums and annotations. - */ - @Injectable() - export class Poems { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * Add poem. If created is undefined, it will be now. And modified is always now. - * POST api/Poems - * @return {Fonlow_PoemsApp_Data_Client.Poem} Id of newly added - */ - add(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add new poem with existing annotations and new annotation names. - * PUT api/Poems/AddWithExistingAnnotations - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndAnnotations new poem, existing Annotation Ids, and new annotation names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new annotation objects - */ - addWithExistingAnnotations(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/AddWithExistingAnnotations', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Poem with Tags - * POST api/Poems/addWithExistingTags - */ - addWithExistingTags(poemAndTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/addWithExistingTags', JSON.stringify(poemAndTags), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * PUT api/Poems/AddWithNewAnnotationNames - */ - addWithNewAnnotationNames(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/AddWithNewAnnotationNames', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add new poem with existing tags, and new tag names. - * POST api/Poems/AddWithNewTagNames - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndNewTags new poem, existing Tag Ids, and new tag names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new tag objects - */ - addWithNewTagNames(poemAndNewTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/AddWithNewTagNames', JSON.stringify(poemAndNewTags), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Associate album with existing poems. - * PUT api/Poems/poemsToAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - */ - associateAlbumWithPoems(albumId?: string | null, poemIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/poemsToAlbum?albumId=' + albumId, JSON.stringify(poemIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing albums. - * PUT api/Poems/albums?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithAlbums(poemId?: string | null, albumIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/albums?poemId=' + poemId, JSON.stringify(albumIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing annotations. - * PUT api/Poems/existingAnnotations?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingAnnotations(poemId?: string | null, existingAnnotationIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/existingAnnotations?poemId=' + poemId, JSON.stringify(existingAnnotationIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing tags. - * PUT api/Poems/existingTags?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingTags(poemId?: string | null, existingTagIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/existingTags?poemId=' + poemId, JSON.stringify(existingTagIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Save the new annotation, and associate with the poem. - * If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - * PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.AnnotationBrief} New annotation, or null if the annotation exists - */ - associateWithNewAnnotationName(poemId?: string | null, newAnnotationName?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/newAnnotationName?poemId=' + poemId + '&newAnnotationName=' + (!newAnnotationName ? '' : encodeURIComponent(newAnnotationName)), null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newAnnotationNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New annotation objects based on newAnnotationNames - */ - associateWithNewAnnotationNames(poemId?: string | null, newAnnotationNames?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put>(this.baseUri + 'api/Poems/newAnnotationNames?poemId=' + poemId, JSON.stringify(newAnnotationNames), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Save the new tag, and associate with the poem. - * If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - * PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.Tag} New tag, or null if the tag exists - */ - associateWithNewTagName(poemId?: string | null, newTagName?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/newTagName?poemId=' + poemId + '&newTagName=' + (!newTagName ? '' : encodeURIComponent(newTagName)), null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newTagNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New tag objects based on newTagNames - */ - associateWithNewTagNames(poemId?: string | null, newTagNames?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put>(this.baseUri + 'api/Poems/newTagNames?poemId=' + poemId, JSON.stringify(newTagNames), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Reconcile among all images, poemImageMaps, and actually img local - * POST api/Poems/AuditAndReconcile - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - auditAndReconcile(headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/AuditAndReconcile', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * DELETE api/Poems/all - */ - clearAllTables(headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/all', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - * DELETE api/Poems?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Dissociate album. - * DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - * @param {string} poemId Type: GUID - * @param {string} albumId Type: GUID - */ - dissociateAlbum(poemId?: string | null, albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateAlbum?poemId=' + poemId + '&albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Disassociate annotation. - * DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - * @param {string} poemId Type: GUID - * @param {string} annotationId Type: GUID - */ - dissociateAnnotation(poemId?: string | null, annotationId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateAnnotation?poemId=' + poemId + '&annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * DissociateT tag. - * DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - * @param {string} poemId Type: GUID - * @param {string} tagId Type: GUID - */ - dissociateTag(poemId?: string | null, tagId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateTag?poemId=' + poemId + '&tagId=' + tagId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - * PUT api/Poems/EscapeStringToUnicode - */ - escapeStringToUnicode(headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/EscapeStringToUnicode', null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Include TagMap and AlbumMap. Support ZH Convert. - * GET api/Poems?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Img Src Url to multiple poem Ids - * GET api/Poems/AllNotLocalImagesOfPoems - */ - getAllNotLocalImagesOfPoems(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Array }> { - return this.http.get<{[id: string]: Array }>(this.baseUri + 'api/Poems/AllNotLocalImagesOfPoems', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - * POST api/Poems/AssociatedPoemsOfImages - */ - getAssociatedPoemsOfAllImages(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Array }> { - return this.http.post<{[id: string]: Array }>(this.baseUri + 'api/Poems/AssociatedPoemsOfImages', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - * GET api/Poems/AllBriefs - * @param {number} timezoneOffset int in header - */ - getBriefsOfPoems(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/AllBriefs', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * All poems of album, order by published. Support ZH Convert. - * GET api/Poems/GetOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {string} convertZH string in header - * @param {number} timezoneOffset int in header - */ - getOfAlbum(albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/GetOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {number} timezoneOffset int in header - */ - getPoemBriefsOfAlbum(albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/GetPoemBriefsOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollection - */ - getPoemCollection(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollection', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionInOtherChineseWriting - */ - getPoemCollectionInOtherChineseWriting(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionPublished - * @param {number} timezoneOffset In request headers - */ - getPoemCollectionPublished(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionPublished', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - * @param {number} timezoneOffset timezoneOffset in headers - */ - getPoemCollectionPublishedInOtherChineseWriting(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionPublishedInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - * @param {string} imageId Type: GUID - */ - getPoemsWithInternalImageId(imageId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/PoemsWithInternalImageId?imageId=' + imageId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/TotalCountOfStanza - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getTotalCountOfStanza(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/TotalCountOfStanza', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Poems/PoemCollection - */ - importPoemCollection(collection?: Fonlow_PoemsApp_Data_Client.PoemCollection | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/Poems/PoemCollection', JSON.stringify(collection), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * GET api/Poems/ByAnnotation?annotationId={annotationId} - * @param {string} annotationId Type: GUID - */ - searchByAnnotation(annotationId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/ByAnnotation?annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - * POST api/Poems/ByKeywords - * @param {number} timezoneOffset int in header - */ - searchByKeywords(keywords?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post>(this.baseUri + 'api/Poems/ByKeywords', JSON.stringify(keywords), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Update poem. - * PUT api/Poems - */ - update(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Just for maintenance, while the plaintext should be produced in the frontend. - * POST api/Poems/UpdatePlainTextOfHtmlPoems - */ - updatePlainTextOfHtmlPoems(headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/Poems/UpdatePlainTextOfHtmlPoems', null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * PUT api/Poems/UpdatePublished?poemId={poemId} - * @param {string} poemId Type: GUID - */ - updatePublished(poemId?: string | null, dt?: Date | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/UpdatePublished?poemId=' + poemId, JSON.stringify(dt), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Tags management - */ +export namespace DemoCoreWeb_Controllers_Client { @Injectable() - export class Tags { + export class SpecialTypes { constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { } /** - * POST api/Tags - * @return {string} Type: GUID - */ - add(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemTagMap. - * DELETE api/Tags?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Tags/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Tags/Orphaned', JSON.stringify(ids), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Get tag. Support ZH Convert. - * GET api/Tags?id={id} - * @param {string} id Type: GUID + * Anonymous Dynamic of C# + * GET api/SpecialTypes/AnonymousDynamic + * @return {any} dyanmic things */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); + getAnonymousDynamic(headersHandler?: () => HttpHeaders): Observable> { + return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); } /** - * Get all tags. Support ZH Convert. - * GET api/Tags/all + * Async function returing dynamic + * GET api/SpecialTypes/AnonymousDynamic2 */ - getAll(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/all', { headers: headersHandler ? headersHandler() : undefined }); + getAnonymousDynamic2(headersHandler?: () => HttpHeaders): Observable> { + return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic2', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); } /** - * Get all tags as dictionary. Support ZH Convert. - * GET api/Tags/allDic + * GET api/SpecialTypes/AnonymousObject */ - getAllDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }>(this.baseUri + 'api/Tags/allDic', { headers: headersHandler ? headersHandler() : undefined }); + getAnonymousObject(headersHandler?: () => HttpHeaders): Observable> { + return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousObject', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); } /** - * GET api/Tags/Orphaned + * Async function returning object + * GET api/SpecialTypes/AnonymousObject2 */ - getOrphaned(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/Orphaned', { headers: headersHandler ? headersHandler() : undefined }); + getAnonymousObject2(headersHandler?: () => HttpHeaders): Observable> { + return this.http.get(this.baseUri + 'api/SpecialTypes/AnonymousObject2', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); } /** - * GET api/Tags/PoemCountOfTags + * POST api/SpecialTypes/AnonymousObject */ - getPoemCountOfTags(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/PoemCountOfTags', { headers: headersHandler ? headersHandler() : undefined }); + postAnonymousObject(obj?: any, headersHandler?: () => HttpHeaders): Observable> { + return this.http.post(this.baseUri + 'api/SpecialTypes/AnonymousObject', JSON.stringify(obj), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); } /** - * PUT api/Tags + * Async returning object, Post dynamic + * POST api/SpecialTypes/AnonymousObject2 */ - update(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); + postAnonymousObject2(obj?: any, headersHandler?: () => HttpHeaders): Observable> { + return this.http.post(this.baseUri + 'api/SpecialTypes/AnonymousObject2', JSON.stringify(obj), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); } } diff --git a/HeroesDemo/src/clientapi/WebApiCoreNg2ClientAuto.ts b/HeroesDemo/src/clientapi/WebApiCoreNg2ClientAuto.ts index 54a8a31f..617cc1a9 100644 --- a/HeroesDemo/src/clientapi/WebApiCoreNg2ClientAuto.ts +++ b/HeroesDemo/src/clientapi/WebApiCoreNg2ClientAuto.ts @@ -1916,302 +1916,6 @@ export namespace DemoWebApi_Models_Client { } -export namespace Fonlow_PoemsApp_Data_Client { - export interface Album { - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published?: Date | null; - - /** - * First published Url - */ - publishedUrl?: string | null; - - /** - * Album title should never be changed. - */ - title?: string | null; - } - - export interface Annotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** */ - name?: string | null; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface AnnotationBrief { - - /** - * Count of poems associated - */ - count?: number | null; - - /** Type: GUID */ - id: string; - name: string; - } - - export interface AnnotationPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - - export enum BodyType { Text, HTML, MD } - - export interface ExternalImageMap { - description?: string | null; - name?: string | null; - poemIds?: Array; - srcUrl?: string | null; - } - - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCode { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code?: string | null; - display?: string | null; - } - - export interface LoginModel { - emailAddress?: string | null; - firstName?: string | null; - idToken?: string | null; - lastName?: string | null; - name?: string | null; - pictureUrl?: string | null; - provider?: string | null; - userId?: string | null; - } - - export interface MetaData { - key?: string | null; - value?: string | null; - } - - export interface MetaDataPoemCount { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count?: number | null; - - /** Type: GUID */ - id: string; - } - - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: number; - - /** */ - poemId: string; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface NumberedAnnotationBrief { - - /** Type: GUID */ - id: string; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: number; - } - - export interface Picture extends Fonlow_PoemsApp_Data_Client.PictureMeta { - content?: Array; - } - - export interface PictureMeta { - contentType?: string | null; - - /** Max length: 512 */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** Max length: 128 */ - name?: string | null; - } - - export interface PicturePoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - poemIds?: Array; - } - - export interface Poem { - - /** - * A poem may be included in multipe albums. - * UI may use this to present albums - */ - albumIds?: Array; - annotationIds?: Array; - body?: string | null; - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain?: string | null; - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - - /** - * Author should be able to alter. The default is the created time. - */ - created?: Date | null; - - /** Type: GUID */ - id?: string | null; - modified?: Date | null; - numberedAnnotationBriefs?: Array; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza?: number | null; - pictureIds?: Array; - - /** - * to distinguish draft or published. DateTime. - */ - published?: Date | null; - - /** - * Initial published URL. - */ - publishedUrl?: string | null; - ryhmesCsv?: string | null; - - /** - * UI use this to represent tags. This is not included n DB. - */ - tagIds?: Array; - title?: string | null; - } - - export interface PoemAlbumMap { - - /** Type: GUID */ - albumId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemAnnotationMap { - - /** Type: GUID */ - annotationId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemBrief { - date: Date; - - /** Type: GUID */ - id: string; - published?: Date | null; - tagIds?: Array; - title: string; - } - - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollection { - albumMaps: Array; - albums: Array; - annotationMaps: Array; - annotations: Array; - keyValues: Array; - numberedAnnotations: Array; - pictureMaps?: Array; - pictureMetas?: Array; - poems: Array; - tagMaps: Array; - tags: Array; - } - - export interface PoemPictureMap { - - /** Type: GUID */ - pictureId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemTagMap { - - /** Type: GUID */ - poemId?: string | null; - - /** Type: GUID */ - tagId?: string | null; - } - - export interface Tag { - - /** Type: GUID */ - id?: string | null; - name?: string | null; - } - - export interface TagPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - -} - export namespace DemoCoreWeb_Controllers_Client { @Injectable() export class SpecialTypes { @@ -2268,642 +1972,3 @@ export namespace DemoCoreWeb_Controllers_Client { } -export namespace PoemsApp_Controllers_Client { - - /** - * Album specific operations - */ - @Injectable() - export class Albums { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * Add album. If publisheDate is not defined, it will be now. - * POST api/Albums - */ - add(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemAlbumMap. - * DELETE api/Albums?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get Album. Support ZH Convert. - * GET api/Albums?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all albums. Support ZH Convert. - * GET api/Albums/all - * @param {number} timezoneOffset int in header - */ - getAll(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Albums/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all albums as dictionary. Support ZH Convert. - * GET api/Albums/allDic - * @param {number} timezoneOffset int in header - */ - getAllDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }>(this.baseUri + 'api/Albums/allDic', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Albums - */ - update(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - @Injectable() - export class Annotations { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * POST api/Annotations - * @return {string} Type: GUID - */ - add(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemAnnotationMap. - * DELETE api/Annotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Annotations/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Annotations/Orphaned', JSON.stringify(ids), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Get annotation. Support ZH Convert. - * GET api/Annotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/all - */ - getAnnotationBriefs(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all annotation briefs. Support ZH Convert. - * GET api/Annotations/allDic - */ - getAnnotationBriefsDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }>(this.baseUri + 'api/Annotations/allDic', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/Orphaned - */ - getOrphaned(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/Orphaned', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Annotations/PoemCountOfAnnotations - */ - getPoemCountOfAnnotations(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Annotations/PoemCountOfAnnotations', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Annotations - */ - update(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - @Injectable() - export class NumberedAnnotations { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * POST api/NumberedAnnotations - * @return {string} Type: GUID - */ - add(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add multiple annotations - * POST api/NumberedAnnotations/poem/{poemId} - * @param {string} poemId Type: GUID - */ - addMuitiple(poemId?: string | null, orderNumbers?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post>(this.baseUri + 'api/NumberedAnnotations/poem/' + poemId, JSON.stringify(orderNumbers), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Update the orders of numbered annotations in a transaction - * PUT api/NumberedAnnotations/BulkOrderNumbers - */ - bulkUpdateOrderNumbers(idAndOrderArray?: Array<{item1: string, item2: number}> | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations/BulkOrderNumbers', JSON.stringify(idAndOrderArray), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Delete along with what in poemNumberedAnnotationMap. - * DELETE api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get numberedAnnotation. Support ZH Convert. - * GET api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Update annotation - * PUT api/NumberedAnnotations - */ - update(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Update Order Number - * PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - * @param {string} id Type: GUID - * @param {number} orderNumber Type: int, -2,147,483,648 to 2,147,483,647 - */ - updateOrderNumber(id?: string | null, orderNumber?: number | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/NumberedAnnotations/OrderNumber?id=' + id + '&orderNumber=' + orderNumber, null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - } - - - /** - * Poems operations; associations with tags, albums and annotations. - */ - @Injectable() - export class Poems { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * Add poem. If created is undefined, it will be now. And modified is always now. - * POST api/Poems - * @return {Fonlow_PoemsApp_Data_Client.Poem} Id of newly added - */ - add(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add new poem with existing annotations and new annotation names. - * PUT api/Poems/AddWithExistingAnnotations - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndAnnotations new poem, existing Annotation Ids, and new annotation names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new annotation objects - */ - addWithExistingAnnotations(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/AddWithExistingAnnotations', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Poem with Tags - * POST api/Poems/addWithExistingTags - */ - addWithExistingTags(poemAndTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/addWithExistingTags', JSON.stringify(poemAndTags), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * PUT api/Poems/AddWithNewAnnotationNames - */ - addWithNewAnnotationNames(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/AddWithNewAnnotationNames', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Add new poem with existing tags, and new tag names. - * POST api/Poems/AddWithNewTagNames - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndNewTags new poem, existing Tag Ids, and new tag names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new tag objects - */ - addWithNewTagNames(poemAndNewTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/AddWithNewTagNames', JSON.stringify(poemAndNewTags), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Associate album with existing poems. - * PUT api/Poems/poemsToAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - */ - associateAlbumWithPoems(albumId?: string | null, poemIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/poemsToAlbum?albumId=' + albumId, JSON.stringify(poemIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing albums. - * PUT api/Poems/albums?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithAlbums(poemId?: string | null, albumIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/albums?poemId=' + poemId, JSON.stringify(albumIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing annotations. - * PUT api/Poems/existingAnnotations?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingAnnotations(poemId?: string | null, existingAnnotationIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/existingAnnotations?poemId=' + poemId, JSON.stringify(existingAnnotationIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Associate with existing tags. - * PUT api/Poems/existingTags?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingTags(poemId?: string | null, existingTagIds?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/existingTags?poemId=' + poemId, JSON.stringify(existingTagIds), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Save the new annotation, and associate with the poem. - * If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - * PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.AnnotationBrief} New annotation, or null if the annotation exists - */ - associateWithNewAnnotationName(poemId?: string | null, newAnnotationName?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/newAnnotationName?poemId=' + poemId + '&newAnnotationName=' + (!newAnnotationName ? '' : encodeURIComponent(newAnnotationName)), null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newAnnotationNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New annotation objects based on newAnnotationNames - */ - associateWithNewAnnotationNames(poemId?: string | null, newAnnotationNames?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put>(this.baseUri + 'api/Poems/newAnnotationNames?poemId=' + poemId, JSON.stringify(newAnnotationNames), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Save the new tag, and associate with the poem. - * If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - * PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.Tag} New tag, or null if the tag exists - */ - associateWithNewTagName(poemId?: string | null, newTagName?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.put(this.baseUri + 'api/Poems/newTagName?poemId=' + poemId + '&newTagName=' + (!newTagName ? '' : encodeURIComponent(newTagName)), null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newTagNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New tag objects based on newTagNames - */ - associateWithNewTagNames(poemId?: string | null, newTagNames?: Array | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put>(this.baseUri + 'api/Poems/newTagNames?poemId=' + poemId, JSON.stringify(newTagNames), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Reconcile among all images, poemImageMaps, and actually img local - * POST api/Poems/AuditAndReconcile - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - auditAndReconcile(headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Poems/AuditAndReconcile', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * DELETE api/Poems/all - */ - clearAllTables(headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/all', { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - * DELETE api/Poems?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Dissociate album. - * DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - * @param {string} poemId Type: GUID - * @param {string} albumId Type: GUID - */ - dissociateAlbum(poemId?: string | null, albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateAlbum?poemId=' + poemId + '&albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Disassociate annotation. - * DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - * @param {string} poemId Type: GUID - * @param {string} annotationId Type: GUID - */ - dissociateAnnotation(poemId?: string | null, annotationId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateAnnotation?poemId=' + poemId + '&annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * DissociateT tag. - * DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - * @param {string} poemId Type: GUID - * @param {string} tagId Type: GUID - */ - dissociateTag(poemId?: string | null, tagId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.delete(this.baseUri + 'api/Poems/DissociateTag?poemId=' + poemId + '&tagId=' + tagId, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - * PUT api/Poems/EscapeStringToUnicode - */ - escapeStringToUnicode(headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/EscapeStringToUnicode', null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * Include TagMap and AlbumMap. Support ZH Convert. - * GET api/Poems?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Img Src Url to multiple poem Ids - * GET api/Poems/AllNotLocalImagesOfPoems - */ - getAllNotLocalImagesOfPoems(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Array }> { - return this.http.get<{[id: string]: Array }>(this.baseUri + 'api/Poems/AllNotLocalImagesOfPoems', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - * POST api/Poems/AssociatedPoemsOfImages - */ - getAssociatedPoemsOfAllImages(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Array }> { - return this.http.post<{[id: string]: Array }>(this.baseUri + 'api/Poems/AssociatedPoemsOfImages', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - * GET api/Poems/AllBriefs - * @param {number} timezoneOffset int in header - */ - getBriefsOfPoems(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/AllBriefs', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * All poems of album, order by published. Support ZH Convert. - * GET api/Poems/GetOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {string} convertZH string in header - * @param {number} timezoneOffset int in header - */ - getOfAlbum(albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/GetOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {number} timezoneOffset int in header - */ - getPoemBriefsOfAlbum(albumId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/GetPoemBriefsOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollection - */ - getPoemCollection(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollection', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionInOtherChineseWriting - */ - getPoemCollectionInOtherChineseWriting(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionPublished - * @param {number} timezoneOffset In request headers - */ - getPoemCollectionPublished(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionPublished', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - * @param {number} timezoneOffset timezoneOffset in headers - */ - getPoemCollectionPublishedInOtherChineseWriting(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/PoemCollectionPublishedInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - * @param {string} imageId Type: GUID - */ - getPoemsWithInternalImageId(imageId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/PoemsWithInternalImageId?imageId=' + imageId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Poems/TotalCountOfStanza - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getTotalCountOfStanza(headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Poems/TotalCountOfStanza', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Poems/PoemCollection - */ - importPoemCollection(collection?: Fonlow_PoemsApp_Data_Client.PoemCollection | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/Poems/PoemCollection', JSON.stringify(collection), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * GET api/Poems/ByAnnotation?annotationId={annotationId} - * @param {string} annotationId Type: GUID - */ - searchByAnnotation(annotationId?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Poems/ByAnnotation?annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - * POST api/Poems/ByKeywords - * @param {number} timezoneOffset int in header - */ - searchByKeywords(keywords?: string | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.post>(this.baseUri + 'api/Poems/ByKeywords', JSON.stringify(keywords), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Update poem. - * PUT api/Poems - */ - update(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - - /** - * Just for maintenance, while the plaintext should be produced in the frontend. - * POST api/Poems/UpdatePlainTextOfHtmlPoems - */ - updatePlainTextOfHtmlPoems(headersHandler?: () => HttpHeaders): Observable> { - return this.http.post(this.baseUri + 'api/Poems/UpdatePlainTextOfHtmlPoems', null, { headers: headersHandler ? headersHandler() : undefined, observe: 'response', responseType: 'text' }); - } - - /** - * PUT api/Poems/UpdatePublished?poemId={poemId} - * @param {string} poemId Type: GUID - */ - updatePublished(poemId?: string | null, dt?: Date | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Poems/UpdatePublished?poemId=' + poemId, JSON.stringify(dt), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - - - /** - * Tags management - */ - @Injectable() - export class Tags { - constructor(@Inject('baseUri') private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/', private http: HttpClient) { - } - - /** - * POST api/Tags - * @return {string} Type: GUID - */ - add(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Delete along with what in poemTagMap. - * DELETE api/Tags?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.delete(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * POST api/Tags/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Tags/Orphaned', JSON.stringify(ids), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - - /** - * Get tag. Support ZH Convert. - * GET api/Tags?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.get(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all tags. Support ZH Convert. - * GET api/Tags/all - */ - getAll(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Get all tags as dictionary. Support ZH Convert. - * GET api/Tags/allDic - */ - getAllDic(headersHandler?: () => HttpHeaders): Observable<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }> { - return this.http.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }>(this.baseUri + 'api/Tags/allDic', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Tags/Orphaned - */ - getOrphaned(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/Orphaned', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * GET api/Tags/PoemCountOfTags - */ - getPoemCountOfTags(headersHandler?: () => HttpHeaders): Observable> { - return this.http.get>(this.baseUri + 'api/Tags/PoemCountOfTags', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Tags - */ - update(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => HttpHeaders): Observable> { - return this.http.put(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }), observe: 'response', responseType: 'text' }); - } - } - -} - diff --git a/StartDemoTextJsonWeb.ps1 b/StartDemoTextJsonWeb.ps1 index 00ea9c53..9f67d7b4 100644 --- a/StartDemoTextJsonWeb.ps1 +++ b/StartDemoTextJsonWeb.ps1 @@ -3,11 +3,11 @@ cd $PSScriptRoot $path = "$PSScriptRoot/DemoTextJsonWeb" $procArgs = @{ FilePath = "dotnet.exe" - ArgumentList = "run --project $path/DemoTextJsonWeb.csproj --no-build" + ArgumentList = "run --project $path/DemoTextJsonWeb.csproj --no-build --launch-profile CodeGen" WorkingDirectory = $path PassThru = $true } $process = Start-Process @procArgs -Invoke-RestMethod http://localhost:6000/api/values -Method GET +Invoke-RestMethod http://localhost:5000/api/values -Method GET diff --git a/Tests/IntegrationTestsTextJson/appsettings.json b/Tests/IntegrationTestsTextJson/appsettings.json index 38958acd..c52fd515 100644 --- a/Tests/IntegrationTestsTextJson/appsettings.json +++ b/Tests/IntegrationTestsTextJson/appsettings.json @@ -3,7 +3,7 @@ "ServiceCommands": [ { "CommandPath": "dotnet", - "Arguments": "run --project ../../../../../DemoTextJsonWeb/DemoTextJsonWeb.csproj --no-build --configuration Release", + "Arguments": "run --project ../../../../../DemoTextJsonWeb/DemoTextJsonWeb.csproj --no-build --configuration Release --launch-profile http", "BaseUrl": "http://127.0.0.1:6000/", "Delay": 5 } diff --git a/aurelia/src/clientapi/WebApiCoreAureliaClientAuto.ts b/aurelia/src/clientapi/WebApiCoreAureliaClientAuto.ts index 96b6a4d7..836a9c29 100644 --- a/aurelia/src/clientapi/WebApiCoreAureliaClientAuto.ts +++ b/aurelia/src/clientapi/WebApiCoreAureliaClientAuto.ts @@ -1915,302 +1915,6 @@ export namespace DemoWebApi_Models_Client { } -export namespace Fonlow_PoemsApp_Data_Client { - export interface Album { - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published?: Date | null; - - /** - * First published Url - */ - publishedUrl?: string | null; - - /** - * Album title should never be changed. - */ - title?: string | null; - } - - export interface Annotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** */ - name?: string | null; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface AnnotationBrief { - - /** - * Count of poems associated - */ - count?: number | null; - - /** Type: GUID */ - id: string; - name: string; - } - - export interface AnnotationPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - - export enum BodyType { Text, HTML, MD } - - export interface ExternalImageMap { - description?: string | null; - name?: string | null; - poemIds?: Array; - srcUrl?: string | null; - } - - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCode { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code?: string | null; - display?: string | null; - } - - export interface LoginModel { - emailAddress?: string | null; - firstName?: string | null; - idToken?: string | null; - lastName?: string | null; - name?: string | null; - pictureUrl?: string | null; - provider?: string | null; - userId?: string | null; - } - - export interface MetaData { - key?: string | null; - value?: string | null; - } - - export interface MetaDataPoemCount { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count?: number | null; - - /** Type: GUID */ - id: string; - } - - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: number; - - /** */ - poemId: string; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface NumberedAnnotationBrief { - - /** Type: GUID */ - id: string; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: number; - } - - export interface Picture extends Fonlow_PoemsApp_Data_Client.PictureMeta { - content?: Array; - } - - export interface PictureMeta { - contentType?: string | null; - - /** Max length: 512 */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** Max length: 128 */ - name?: string | null; - } - - export interface PicturePoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - poemIds?: Array; - } - - export interface Poem { - - /** - * A poem may be included in multipe albums. - * UI may use this to present albums - */ - albumIds?: Array; - annotationIds?: Array; - body?: string | null; - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain?: string | null; - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - - /** - * Author should be able to alter. The default is the created time. - */ - created?: Date | null; - - /** Type: GUID */ - id?: string | null; - modified?: Date | null; - numberedAnnotationBriefs?: Array; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza?: number | null; - pictureIds?: Array; - - /** - * to distinguish draft or published. DateTime. - */ - published?: Date | null; - - /** - * Initial published URL. - */ - publishedUrl?: string | null; - ryhmesCsv?: string | null; - - /** - * UI use this to represent tags. This is not included n DB. - */ - tagIds?: Array; - title?: string | null; - } - - export interface PoemAlbumMap { - - /** Type: GUID */ - albumId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemAnnotationMap { - - /** Type: GUID */ - annotationId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemBrief { - date: Date; - - /** Type: GUID */ - id: string; - published?: Date | null; - tagIds?: Array; - title: string; - } - - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollection { - albumMaps: Array; - albums: Array; - annotationMaps: Array; - annotations: Array; - keyValues: Array; - numberedAnnotations: Array; - pictureMaps?: Array; - pictureMetas?: Array; - poems: Array; - tagMaps: Array; - tags: Array; - } - - export interface PoemPictureMap { - - /** Type: GUID */ - pictureId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemTagMap { - - /** Type: GUID */ - poemId?: string | null; - - /** Type: GUID */ - tagId?: string | null; - } - - export interface Tag { - - /** Type: GUID */ - id?: string | null; - name?: string | null; - } - - export interface TagPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - -} - export namespace DemoCoreWeb_Controllers_Client { @autoinject() export class SpecialTypes { @@ -2267,642 +1971,3 @@ export namespace DemoCoreWeb_Controllers_Client { } -export namespace PoemsApp_Controllers_Client { - - /** - * Album specific operations - */ - @autoinject() - export class Albums { - constructor(private http: HttpClient) { - } - - /** - * Add album. If publisheDate is not defined, it will be now. - * POST api/Albums - */ - add(album: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Albums', JSON.stringify(album), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Delete along with what in poemAlbumMap. - * DELETE api/Albums?id={id} - * @param {string} id Type: GUID - */ - delete(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get Album. Support ZH Convert. - * GET api/Albums?id={id} - * @param {string} id Type: GUID - */ - get(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get all albums. Support ZH Convert. - * GET api/Albums/all - * @param {number} timezoneOffset int in header - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Albums/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get all albums as dictionary. Support ZH Convert. - * GET api/Albums/allDic - * @param {number} timezoneOffset int in header - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }> { - return this.http.get('api/Albums/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * PUT api/Albums - */ - update(album: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Albums', JSON.stringify(album), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - } - - - /** - * Annotations management - */ - @autoinject() - export class Annotations { - constructor(private http: HttpClient) { - } - - /** - * POST api/Annotations - * @return {string} Type: GUID - */ - add(annotation: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Delete along with what in poemAnnotationMap. - * DELETE api/Annotations?id={id} - * @param {string} id Type: GUID - */ - delete(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * POST api/Annotations/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Annotations/Orphaned', JSON.stringify(ids), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get annotation. Support ZH Convert. - * GET api/Annotations?id={id} - * @param {string} id Type: GUID - */ - get(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Annotations/all - */ - getAnnotationBriefs(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Annotations/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get all annotation briefs. Support ZH Convert. - * GET api/Annotations/allDic - */ - getAnnotationBriefsDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }> { - return this.http.get('api/Annotations/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Annotations/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Annotations/Orphaned', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Annotations/PoemCountOfAnnotations - */ - getPoemCountOfAnnotations(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Annotations/PoemCountOfAnnotations', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * PUT api/Annotations - */ - update(annotation: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - } - - - /** - * Annotations management - */ - @autoinject() - export class NumberedAnnotations { - constructor(private http: HttpClient) { - } - - /** - * POST api/NumberedAnnotations - * @return {string} Type: GUID - */ - add(numberedAnnotation: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Add multiple annotations - * POST api/NumberedAnnotations/poem/{poemId} - * @param {string} poemId Type: GUID - */ - addMuitiple(poemId: string | null, orderNumbers: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.post('api/NumberedAnnotations/poem/' + poemId, JSON.stringify(orderNumbers), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Update the orders of numbered annotations in a transaction - * PUT api/NumberedAnnotations/BulkOrderNumbers - */ - bulkUpdateOrderNumbers(idAndOrderArray: Array<{item1: string, item2: number}> | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/NumberedAnnotations/BulkOrderNumbers', JSON.stringify(idAndOrderArray), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Delete along with what in poemNumberedAnnotationMap. - * DELETE api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - delete(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get numberedAnnotation. Support ZH Convert. - * GET api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - get(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Update annotation - * PUT api/NumberedAnnotations - */ - update(numberedAnnotation: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Update Order Number - * PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - * @param {string} id Type: GUID - * @param {number} orderNumber Type: int, -2,147,483,648 to 2,147,483,647 - */ - updateOrderNumber(id: string | null, orderNumber: number | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/NumberedAnnotations/OrderNumber?id=' + id + '&orderNumber=' + orderNumber, null, { headers: headersHandler ? headersHandler() : undefined }); - } - } - - - /** - * Poems operations; associations with tags, albums and annotations. - */ - @autoinject() - export class Poems { - constructor(private http: HttpClient) { - } - - /** - * Add poem. If created is undefined, it will be now. And modified is always now. - * POST api/Poems - * @return {Fonlow_PoemsApp_Data_Client.Poem} Id of newly added - */ - add(poem: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems', JSON.stringify(poem), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Add new poem with existing annotations and new annotation names. - * PUT api/Poems/AddWithExistingAnnotations - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndAnnotations new poem, existing Annotation Ids, and new annotation names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new annotation objects - */ - addWithExistingAnnotations(poemAndAnnotations: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/AddWithExistingAnnotations', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Poem with Tags - * POST api/Poems/addWithExistingTags - */ - addWithExistingTags(poemAndTags: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems/addWithExistingTags', JSON.stringify(poemAndTags), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * PUT api/Poems/AddWithNewAnnotationNames - */ - addWithNewAnnotationNames(poemAndAnnotations: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/AddWithNewAnnotationNames', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Add new poem with existing tags, and new tag names. - * POST api/Poems/AddWithNewTagNames - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndNewTags new poem, existing Tag Ids, and new tag names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new tag objects - */ - addWithNewTagNames(poemAndNewTags: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems/AddWithNewTagNames', JSON.stringify(poemAndNewTags), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Associate album with existing poems. - * PUT api/Poems/poemsToAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - */ - associateAlbumWithPoems(albumId: string | null, poemIds: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/poemsToAlbum?albumId=' + albumId, JSON.stringify(poemIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Associate with existing albums. - * PUT api/Poems/albums?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithAlbums(poemId: string | null, albumIds: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/albums?poemId=' + poemId, JSON.stringify(albumIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Associate with existing annotations. - * PUT api/Poems/existingAnnotations?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingAnnotations(poemId: string | null, existingAnnotationIds: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/existingAnnotations?poemId=' + poemId, JSON.stringify(existingAnnotationIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Associate with existing tags. - * PUT api/Poems/existingTags?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingTags(poemId: string | null, existingTagIds: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/existingTags?poemId=' + poemId, JSON.stringify(existingTagIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Save the new annotation, and associate with the poem. - * If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - * PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.AnnotationBrief} New annotation, or null if the annotation exists - */ - associateWithNewAnnotationName(poemId: string | null, newAnnotationName: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/newAnnotationName?poemId=' + poemId + '&newAnnotationName=' + (!newAnnotationName ? '' : encodeURIComponent(newAnnotationName)), null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newAnnotationNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New annotation objects based on newAnnotationNames - */ - associateWithNewAnnotationNames(poemId: string | null, newAnnotationNames: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.put('api/Poems/newAnnotationNames?poemId=' + poemId, JSON.stringify(newAnnotationNames), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Save the new tag, and associate with the poem. - * If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - * PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.Tag} New tag, or null if the tag exists - */ - associateWithNewTagName(poemId: string | null, newTagName: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/newTagName?poemId=' + poemId + '&newTagName=' + (!newTagName ? '' : encodeURIComponent(newTagName)), null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newTagNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New tag objects based on newTagNames - */ - associateWithNewTagNames(poemId: string | null, newTagNames: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.put('api/Poems/newTagNames?poemId=' + poemId, JSON.stringify(newTagNames), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Reconcile among all images, poemImageMaps, and actually img local - * POST api/Poems/AuditAndReconcile - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - auditAndReconcile(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems/AuditAndReconcile', null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * DELETE api/Poems/all - */ - clearAllTables(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Poems/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - * DELETE api/Poems?id={id} - * @param {string} id Type: GUID - */ - delete(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Dissociate album. - * DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - * @param {string} poemId Type: GUID - * @param {string} albumId Type: GUID - */ - dissociateAlbum(poemId: string | null, albumId: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Poems/DissociateAlbum?poemId=' + poemId + '&albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Disassociate annotation. - * DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - * @param {string} poemId Type: GUID - * @param {string} annotationId Type: GUID - */ - dissociateAnnotation(poemId: string | null, annotationId: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Poems/DissociateAnnotation?poemId=' + poemId + '&annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * DissociateT tag. - * DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - * @param {string} poemId Type: GUID - * @param {string} tagId Type: GUID - */ - dissociateTag(poemId: string | null, tagId: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Poems/DissociateTag?poemId=' + poemId + '&tagId=' + tagId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - * PUT api/Poems/EscapeStringToUnicode - */ - escapeStringToUnicode(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/EscapeStringToUnicode', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Include TagMap and AlbumMap. Support ZH Convert. - * GET api/Poems?id={id} - * @param {string} id Type: GUID - */ - get(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Img Src Url to multiple poem Ids - * GET api/Poems/AllNotLocalImagesOfPoems - */ - getAllNotLocalImagesOfPoems(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return this.http.get('api/Poems/AllNotLocalImagesOfPoems', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - * POST api/Poems/AssociatedPoemsOfImages - */ - getAssociatedPoemsOfAllImages(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return this.http.post('api/Poems/AssociatedPoemsOfImages', null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - * GET api/Poems/AllBriefs - * @param {number} timezoneOffset int in header - */ - getBriefsOfPoems(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Poems/AllBriefs', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * All poems of album, order by published. Support ZH Convert. - * GET api/Poems/GetOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {string} convertZH string in header - * @param {number} timezoneOffset int in header - */ - getOfAlbum(albumId: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Poems/GetOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {number} timezoneOffset int in header - */ - getPoemBriefsOfAlbum(albumId: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Poems/GetPoemBriefsOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/PoemCollection - */ - getPoemCollection(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems/PoemCollection', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/PoemCollectionInOtherChineseWriting - */ - getPoemCollectionInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems/PoemCollectionInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublished - * @param {number} timezoneOffset In request headers - */ - getPoemCollectionPublished(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems/PoemCollectionPublished', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - * @param {number} timezoneOffset timezoneOffset in headers - */ - getPoemCollectionPublishedInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems/PoemCollectionPublishedInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - * @param {string} imageId Type: GUID - */ - getPoemsWithInternalImageId(imageId: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Poems/PoemsWithInternalImageId?imageId=' + imageId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Poems/TotalCountOfStanza - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getTotalCountOfStanza(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Poems/TotalCountOfStanza', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * POST api/Poems/PoemCollection - */ - importPoemCollection(collection: Fonlow_PoemsApp_Data_Client.PoemCollection | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems/PoemCollection', JSON.stringify(collection), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * GET api/Poems/ByAnnotation?annotationId={annotationId} - * @param {string} annotationId Type: GUID - */ - searchByAnnotation(annotationId: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Poems/ByAnnotation?annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - * POST api/Poems/ByKeywords - * @param {number} timezoneOffset int in header - */ - searchByKeywords(keywords: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.post('api/Poems/ByKeywords', JSON.stringify(keywords), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Update poem. - * PUT api/Poems - */ - update(poem: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems', JSON.stringify(poem), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - - /** - * Just for maintenance, while the plaintext should be produced in the frontend. - * POST api/Poems/UpdatePlainTextOfHtmlPoems - */ - updatePlainTextOfHtmlPoems(headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Poems/UpdatePlainTextOfHtmlPoems', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Poems/UpdatePublished?poemId={poemId} - * @param {string} poemId Type: GUID - */ - updatePublished(poemId: string | null, dt: Date | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Poems/UpdatePublished?poemId=' + poemId, JSON.stringify(dt), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - } - - - /** - * Tags management - */ - @autoinject() - export class Tags { - constructor(private http: HttpClient) { - } - - /** - * POST api/Tags - * @return {string} Type: GUID - */ - add(tag: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Tags', JSON.stringify(tag), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Delete along with what in poemTagMap. - * DELETE api/Tags?id={id} - * @param {string} id Type: GUID - */ - delete(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.delete('api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * POST api/Tags/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.post('api/Tags/Orphaned', JSON.stringify(ids), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get tag. Support ZH Convert. - * GET api/Tags?id={id} - * @param {string} id Type: GUID - */ - get(id: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.get('api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get all tags. Support ZH Convert. - * GET api/Tags/all - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Tags/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * Get all tags as dictionary. Support ZH Convert. - * GET api/Tags/allDic - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }> { - return this.http.get('api/Tags/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Tags/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Tags/Orphaned', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * GET api/Tags/PoemCountOfTags - */ - getPoemCountOfTags(headersHandler?: () => {[header: string]: string}): Promise> { - return this.http.get('api/Tags/PoemCountOfTags', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.json(); throw d;}); - } - - /** - * PUT api/Tags - */ - update(tag: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return this.http.put('api/Tags', JSON.stringify(tag), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }); - } - } - -} - diff --git a/axios/src/clientapi/WebApiCoreAxiosClientAuto.ts b/axios/src/clientapi/WebApiCoreAxiosClientAuto.ts index 4c123c22..54b66f64 100644 --- a/axios/src/clientapi/WebApiCoreAxiosClientAuto.ts +++ b/axios/src/clientapi/WebApiCoreAxiosClientAuto.ts @@ -1906,302 +1906,6 @@ export namespace DemoWebApi_Models_Client { } -export namespace Fonlow_PoemsApp_Data_Client { - export interface Album { - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published?: Date | null; - - /** - * First published Url - */ - publishedUrl?: string | null; - - /** - * Album title should never be changed. - */ - title?: string | null; - } - - export interface Annotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** */ - name?: string | null; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface AnnotationBrief { - - /** - * Count of poems associated - */ - count?: number | null; - - /** Type: GUID */ - id: string; - name: string; - } - - export interface AnnotationPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - - export enum BodyType { Text, HTML, MD } - - export interface ExternalImageMap { - description?: string | null; - name?: string | null; - poemIds?: Array; - srcUrl?: string | null; - } - - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCode { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code?: string | null; - display?: string | null; - } - - export interface LoginModel { - emailAddress?: string | null; - firstName?: string | null; - idToken?: string | null; - lastName?: string | null; - name?: string | null; - pictureUrl?: string | null; - provider?: string | null; - userId?: string | null; - } - - export interface MetaData { - key?: string | null; - value?: string | null; - } - - export interface MetaDataPoemCount { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count?: number | null; - - /** Type: GUID */ - id: string; - } - - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: number; - - /** */ - poemId: string; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface NumberedAnnotationBrief { - - /** Type: GUID */ - id: string; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: number; - } - - export interface Picture extends Fonlow_PoemsApp_Data_Client.PictureMeta { - content?: Array; - } - - export interface PictureMeta { - contentType?: string | null; - - /** Max length: 512 */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** Max length: 128 */ - name?: string | null; - } - - export interface PicturePoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - poemIds?: Array; - } - - export interface Poem { - - /** - * A poem may be included in multipe albums. - * UI may use this to present albums - */ - albumIds?: Array; - annotationIds?: Array; - body?: string | null; - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain?: string | null; - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - - /** - * Author should be able to alter. The default is the created time. - */ - created?: Date | null; - - /** Type: GUID */ - id?: string | null; - modified?: Date | null; - numberedAnnotationBriefs?: Array; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza?: number | null; - pictureIds?: Array; - - /** - * to distinguish draft or published. DateTime. - */ - published?: Date | null; - - /** - * Initial published URL. - */ - publishedUrl?: string | null; - ryhmesCsv?: string | null; - - /** - * UI use this to represent tags. This is not included n DB. - */ - tagIds?: Array; - title?: string | null; - } - - export interface PoemAlbumMap { - - /** Type: GUID */ - albumId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemAnnotationMap { - - /** Type: GUID */ - annotationId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemBrief { - date: Date; - - /** Type: GUID */ - id: string; - published?: Date | null; - tagIds?: Array; - title: string; - } - - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollection { - albumMaps: Array; - albums: Array; - annotationMaps: Array; - annotations: Array; - keyValues: Array; - numberedAnnotations: Array; - pictureMaps?: Array; - pictureMetas?: Array; - poems: Array; - tagMaps: Array; - tags: Array; - } - - export interface PoemPictureMap { - - /** Type: GUID */ - pictureId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemTagMap { - - /** Type: GUID */ - poemId?: string | null; - - /** Type: GUID */ - tagId?: string | null; - } - - export interface Tag { - - /** Type: GUID */ - id?: string | null; - name?: string | null; - } - - export interface TagPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - -} - export namespace DemoCoreWeb_Controllers_Client { export class SpecialTypes { constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { @@ -2257,637 +1961,3 @@ export namespace DemoCoreWeb_Controllers_Client { } -export namespace PoemsApp_Controllers_Client { - - /** - * Album specific operations - */ - export class Albums { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * Add album. If publisheDate is not defined, it will be now. - * POST api/Albums - */ - add(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Delete along with what in poemAlbumMap. - * DELETE api/Albums?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get Album. Support ZH Convert. - * GET api/Albums?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Albums?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get all albums. Support ZH Convert. - * GET api/Albums/all - * @param {number} timezoneOffset int in header - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Albums/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get all albums as dictionary. Support ZH Convert. - * GET api/Albums/allDic - * @param {number} timezoneOffset int in header - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }> { - return Axios.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }>(this.baseUri + 'api/Albums/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * PUT api/Albums - */ - update(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Albums', JSON.stringify(album), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - export class Annotations { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/Annotations - * @return {string} Type: GUID - */ - add(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Delete along with what in poemAnnotationMap. - * DELETE api/Annotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * POST api/Annotations/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Annotations/Orphaned', JSON.stringify(ids), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get annotation. Support ZH Convert. - * GET api/Annotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Annotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Annotations/all - */ - getAnnotationBriefs(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Annotations/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get all annotation briefs. Support ZH Convert. - * GET api/Annotations/allDic - */ - getAnnotationBriefsDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }> { - return Axios.get<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }>(this.baseUri + 'api/Annotations/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Annotations/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Annotations/Orphaned', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Annotations/PoemCountOfAnnotations - */ - getPoemCountOfAnnotations(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Annotations/PoemCountOfAnnotations', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * PUT api/Annotations - */ - update(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Annotations', JSON.stringify(annotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - } - - - /** - * Annotations management - */ - export class NumberedAnnotations { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/NumberedAnnotations - * @return {string} Type: GUID - */ - add(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Add multiple annotations - * POST api/NumberedAnnotations/poem/{poemId} - * @param {string} poemId Type: GUID - */ - addMuitiple(poemId?: string | null, orderNumbers?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.post>(this.baseUri + 'api/NumberedAnnotations/poem/' + poemId, JSON.stringify(orderNumbers), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Update the orders of numbered annotations in a transaction - * PUT api/NumberedAnnotations/BulkOrderNumbers - */ - bulkUpdateOrderNumbers(idAndOrderArray?: Array<{item1: string, item2: number}> | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/NumberedAnnotations/BulkOrderNumbers', JSON.stringify(idAndOrderArray), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Delete along with what in poemNumberedAnnotationMap. - * DELETE api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get numberedAnnotation. Support ZH Convert. - * GET api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/NumberedAnnotations?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Update annotation - * PUT api/NumberedAnnotations - */ - update(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/NumberedAnnotations', JSON.stringify(numberedAnnotation), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Update Order Number - * PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - * @param {string} id Type: GUID - * @param {number} orderNumber Type: int, -2,147,483,648 to 2,147,483,647 - */ - updateOrderNumber(id?: string | null, orderNumber?: number | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/NumberedAnnotations/OrderNumber?id=' + id + '&orderNumber=' + orderNumber, null, { headers: headersHandler ? headersHandler() : undefined }); - } - } - - - /** - * Poems operations; associations with tags, albums and annotations. - */ - export class Poems { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * Add poem. If created is undefined, it will be now. And modified is always now. - * POST api/Poems - * @return {Fonlow_PoemsApp_Data_Client.Poem} Id of newly added - */ - add(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Add new poem with existing annotations and new annotation names. - * PUT api/Poems/AddWithExistingAnnotations - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndAnnotations new poem, existing Annotation Ids, and new annotation names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new annotation objects - */ - addWithExistingAnnotations(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/AddWithExistingAnnotations', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Poem with Tags - * POST api/Poems/addWithExistingTags - */ - addWithExistingTags(poemAndTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems/addWithExistingTags', JSON.stringify(poemAndTags), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * PUT api/Poems/AddWithNewAnnotationNames - */ - addWithNewAnnotationNames(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/AddWithNewAnnotationNames', JSON.stringify(poemAndAnnotations), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Add new poem with existing tags, and new tag names. - * POST api/Poems/AddWithNewTagNames - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndNewTags new poem, existing Tag Ids, and new tag names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new tag objects - */ - addWithNewTagNames(poemAndNewTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems/AddWithNewTagNames', JSON.stringify(poemAndNewTags), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Associate album with existing poems. - * PUT api/Poems/poemsToAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - */ - associateAlbumWithPoems(albumId?: string | null, poemIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/poemsToAlbum?albumId=' + albumId, JSON.stringify(poemIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Associate with existing albums. - * PUT api/Poems/albums?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithAlbums(poemId?: string | null, albumIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/albums?poemId=' + poemId, JSON.stringify(albumIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Associate with existing annotations. - * PUT api/Poems/existingAnnotations?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingAnnotations(poemId?: string | null, existingAnnotationIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/existingAnnotations?poemId=' + poemId, JSON.stringify(existingAnnotationIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Associate with existing tags. - * PUT api/Poems/existingTags?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingTags(poemId?: string | null, existingTagIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/existingTags?poemId=' + poemId, JSON.stringify(existingTagIds), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Save the new annotation, and associate with the poem. - * If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - * PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.AnnotationBrief} New annotation, or null if the annotation exists - */ - associateWithNewAnnotationName(poemId?: string | null, newAnnotationName?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/newAnnotationName?poemId=' + poemId + '&newAnnotationName=' + (!newAnnotationName ? '' : encodeURIComponent(newAnnotationName)), null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newAnnotationNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New annotation objects based on newAnnotationNames - */ - associateWithNewAnnotationNames(poemId?: string | null, newAnnotationNames?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.put>(this.baseUri + 'api/Poems/newAnnotationNames?poemId=' + poemId, JSON.stringify(newAnnotationNames), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Save the new tag, and associate with the poem. - * If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - * PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.Tag} New tag, or null if the tag exists - */ - associateWithNewTagName(poemId?: string | null, newTagName?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/newTagName?poemId=' + poemId + '&newTagName=' + (!newTagName ? '' : encodeURIComponent(newTagName)), null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newTagNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New tag objects based on newTagNames - */ - associateWithNewTagNames(poemId?: string | null, newTagNames?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.put>(this.baseUri + 'api/Poems/newTagNames?poemId=' + poemId, JSON.stringify(newTagNames), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Reconcile among all images, poemImageMaps, and actually img local - * POST api/Poems/AuditAndReconcile - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - auditAndReconcile(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems/AuditAndReconcile', null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * DELETE api/Poems/all - */ - clearAllTables(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Poems/all', { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - * DELETE api/Poems?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Dissociate album. - * DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - * @param {string} poemId Type: GUID - * @param {string} albumId Type: GUID - */ - dissociateAlbum(poemId?: string | null, albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Poems/DissociateAlbum?poemId=' + poemId + '&albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Disassociate annotation. - * DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - * @param {string} poemId Type: GUID - * @param {string} annotationId Type: GUID - */ - dissociateAnnotation(poemId?: string | null, annotationId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Poems/DissociateAnnotation?poemId=' + poemId + '&annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * DissociateT tag. - * DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - * @param {string} poemId Type: GUID - * @param {string} tagId Type: GUID - */ - dissociateTag(poemId?: string | null, tagId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Poems/DissociateTag?poemId=' + poemId + '&tagId=' + tagId, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - * PUT api/Poems/EscapeStringToUnicode - */ - escapeStringToUnicode(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/EscapeStringToUnicode', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Include TagMap and AlbumMap. Support ZH Convert. - * GET api/Poems?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Img Src Url to multiple poem Ids - * GET api/Poems/AllNotLocalImagesOfPoems - */ - getAllNotLocalImagesOfPoems(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return Axios.get<{[id: string]: Array }>(this.baseUri + 'api/Poems/AllNotLocalImagesOfPoems', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - * POST api/Poems/AssociatedPoemsOfImages - */ - getAssociatedPoemsOfAllImages(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return Axios.post<{[id: string]: Array }>(this.baseUri + 'api/Poems/AssociatedPoemsOfImages', null, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - * GET api/Poems/AllBriefs - * @param {number} timezoneOffset int in header - */ - getBriefsOfPoems(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Poems/AllBriefs', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * All poems of album, order by published. Support ZH Convert. - * GET api/Poems/GetOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {string} convertZH string in header - * @param {number} timezoneOffset int in header - */ - getOfAlbum(albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Poems/GetOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {number} timezoneOffset int in header - */ - getPoemBriefsOfAlbum(albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Poems/GetPoemBriefsOfAlbum?albumId=' + albumId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/PoemCollection - */ - getPoemCollection(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems/PoemCollection', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionInOtherChineseWriting - */ - getPoemCollectionInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems/PoemCollectionInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublished - * @param {number} timezoneOffset In request headers - */ - getPoemCollectionPublished(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems/PoemCollectionPublished', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - * @param {number} timezoneOffset timezoneOffset in headers - */ - getPoemCollectionPublishedInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems/PoemCollectionPublishedInOtherChineseWriting', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - * @param {string} imageId Type: GUID - */ - getPoemsWithInternalImageId(imageId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Poems/PoemsWithInternalImageId?imageId=' + imageId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Poems/TotalCountOfStanza - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getTotalCountOfStanza(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Poems/TotalCountOfStanza', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * POST api/Poems/PoemCollection - */ - importPoemCollection(collection?: Fonlow_PoemsApp_Data_Client.PoemCollection | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems/PoemCollection', JSON.stringify(collection), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * GET api/Poems/ByAnnotation?annotationId={annotationId} - * @param {string} annotationId Type: GUID - */ - searchByAnnotation(annotationId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Poems/ByAnnotation?annotationId=' + annotationId, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - * POST api/Poems/ByKeywords - * @param {number} timezoneOffset int in header - */ - searchByKeywords(keywords?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.post>(this.baseUri + 'api/Poems/ByKeywords', JSON.stringify(keywords), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Update poem. - * PUT api/Poems - */ - update(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems', JSON.stringify(poem), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - - /** - * Just for maintenance, while the plaintext should be produced in the frontend. - * POST api/Poems/UpdatePlainTextOfHtmlPoems - */ - updatePlainTextOfHtmlPoems(headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Poems/UpdatePlainTextOfHtmlPoems', null, { headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Poems/UpdatePublished?poemId={poemId} - * @param {string} poemId Type: GUID - */ - updatePublished(poemId?: string | null, dt?: Date | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Poems/UpdatePublished?poemId=' + poemId, JSON.stringify(dt), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - } - - - /** - * Tags management - */ - export class Tags { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/Tags - * @return {string} Type: GUID - */ - add(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Delete along with what in poemTagMap. - * DELETE api/Tags?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.delete(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * POST api/Tags/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.post(this.baseUri + 'api/Tags/Orphaned', JSON.stringify(ids), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' } }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get tag. Support ZH Convert. - * GET api/Tags?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.get(this.baseUri + 'api/Tags?id=' + id, { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get all tags. Support ZH Convert. - * GET api/Tags/all - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Tags/all', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * Get all tags as dictionary. Support ZH Convert. - * GET api/Tags/allDic - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }> { - return Axios.get<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }>(this.baseUri + 'api/Tags/allDic', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Tags/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Tags/Orphaned', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * GET api/Tags/PoemCountOfTags - */ - getPoemCountOfTags(headersHandler?: () => {[header: string]: string}): Promise> { - return Axios.get>(this.baseUri + 'api/Tags/PoemCountOfTags', { headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=204) return d.data; throw d;}); - } - - /** - * PUT api/Tags - */ - update(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return Axios.put(this.baseUri + 'api/Tags', JSON.stringify(tag), { headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, responseType: 'text' }); - } - } - -} - diff --git a/fetchapi/src/clientapi/WebApiCoreFetchClientAuto.ts b/fetchapi/src/clientapi/WebApiCoreFetchClientAuto.ts index 3042a6be..a006a0e1 100644 --- a/fetchapi/src/clientapi/WebApiCoreFetchClientAuto.ts +++ b/fetchapi/src/clientapi/WebApiCoreFetchClientAuto.ts @@ -1904,302 +1904,6 @@ export namespace DemoWebApi_Models_Client { } -export namespace Fonlow_PoemsApp_Data_Client { - export interface Album { - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Author should be able to alter. The default is the created time. DateTime. - */ - published?: Date | null; - - /** - * First published Url - */ - publishedUrl?: string | null; - - /** - * Album title should never be changed. - */ - title?: string | null; - } - - export interface Annotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** */ - name?: string | null; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface AnnotationBrief { - - /** - * Count of poems associated - */ - count?: number | null; - - /** Type: GUID */ - id: string; - name: string; - } - - export interface AnnotationPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - - export enum BodyType { Text, HTML, MD } - - export interface ExternalImageMap { - description?: string | null; - name?: string | null; - poemIds?: Array; - srcUrl?: string | null; - } - - - /** - * For wrting or speaking. - * https://www.loc.gov/standards/iso639-2/php/code_list.php - * https://www.rfc-editor.org/rfc/rfc5646 - * https://iso639-3.sil.org/code_tables/639/read - * https://iso639-3.sil.org/code_tables/download_tables - */ - export interface LanguageCode { - - /** - * iso639 code. Could be 639-3, 639-2 or 639-1 - */ - code?: string | null; - display?: string | null; - } - - export interface LoginModel { - emailAddress?: string | null; - firstName?: string | null; - idToken?: string | null; - lastName?: string | null; - name?: string | null; - pictureUrl?: string | null; - provider?: string | null; - userId?: string | null; - } - - export interface MetaData { - key?: string | null; - value?: string | null; - } - - export interface MetaDataPoemCount { - - /** - * Count of poems associated - * Type: int, -2,147,483,648 to 2,147,483,647 - */ - count?: number | null; - - /** Type: GUID */ - id: string; - } - - - /** - * Associated with a specific poem only. - * In case when a phase may be up to different interpretations, then used numbered annotation. - */ - export interface NumberedAnnotation { - - /** - * HTML description - */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** - * Type: int - * Range: inclusive between 1 and 2147483647 - */ - orderNumber: number; - - /** */ - poemId: string; - - /** - * Primary URL for online description like an entry in Wikipedia - */ - url?: string | null; - } - - export interface NumberedAnnotationBrief { - - /** Type: GUID */ - id: string; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - orderNumber: number; - } - - export interface Picture extends Fonlow_PoemsApp_Data_Client.PictureMeta { - content?: Array; - } - - export interface PictureMeta { - contentType?: string | null; - - /** Max length: 512 */ - description?: string | null; - - /** Type: GUID */ - id?: string | null; - - /** Max length: 128 */ - name?: string | null; - } - - export interface PicturePoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - poemIds?: Array; - } - - export interface Poem { - - /** - * A poem may be included in multipe albums. - * UI may use this to present albums - */ - albumIds?: Array; - annotationIds?: Array; - body?: string | null; - - /** - * When bodytype is HTML, a redundant copy for full text search. A poor man solution. - */ - bodyPlain?: string | null; - bodyType?: Fonlow_PoemsApp_Data_Client.BodyType | null; - - /** - * Author should be able to alter. The default is the created time. - */ - created?: Date | null; - - /** Type: GUID */ - id?: string | null; - modified?: Date | null; - numberedAnnotationBriefs?: Array; - - /** Type: int, -2,147,483,648 to 2,147,483,647 */ - numberOfStanza?: number | null; - pictureIds?: Array; - - /** - * to distinguish draft or published. DateTime. - */ - published?: Date | null; - - /** - * Initial published URL. - */ - publishedUrl?: string | null; - ryhmesCsv?: string | null; - - /** - * UI use this to represent tags. This is not included n DB. - */ - tagIds?: Array; - title?: string | null; - } - - export interface PoemAlbumMap { - - /** Type: GUID */ - albumId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemAnnotationMap { - - /** Type: GUID */ - annotationId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemBrief { - date: Date; - - /** Type: GUID */ - id: string; - published?: Date | null; - tagIds?: Array; - title: string; - } - - - /** - * Highest level container for every poems written by a poet, for exporting to other formats - */ - export interface PoemCollection { - albumMaps: Array; - albums: Array; - annotationMaps: Array; - annotations: Array; - keyValues: Array; - numberedAnnotations: Array; - pictureMaps?: Array; - pictureMetas?: Array; - poems: Array; - tagMaps: Array; - tags: Array; - } - - export interface PoemPictureMap { - - /** Type: GUID */ - pictureId?: string | null; - - /** Type: GUID */ - poemId?: string | null; - } - - export interface PoemTagMap { - - /** Type: GUID */ - poemId?: string | null; - - /** Type: GUID */ - tagId?: string | null; - } - - export interface Tag { - - /** Type: GUID */ - id?: string | null; - name?: string | null; - } - - export interface TagPoemCount extends Fonlow_PoemsApp_Data_Client.MetaDataPoemCount { - } - -} - export namespace DemoCoreWeb_Controllers_Client { export class SpecialTypes { constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { @@ -2255,637 +1959,3 @@ export namespace DemoCoreWeb_Controllers_Client { } -export namespace PoemsApp_Controllers_Client { - - /** - * Album specific operations - */ - export class Albums { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * Add album. If publisheDate is not defined, it will be now. - * POST api/Albums - */ - add(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Albums', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(album) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Delete along with what in poemAlbumMap. - * DELETE api/Albums?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Albums?id=' + id, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get Album. Support ZH Convert. - * GET api/Albums?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Albums?id=' + id, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get all albums. Support ZH Convert. - * GET api/Albums/all - * @param {number} timezoneOffset int in header - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Albums/all', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get all albums as dictionary. Support ZH Convert. - * GET api/Albums/allDic - * @param {number} timezoneOffset int in header - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Album }> { - return fetch(this.baseUri + 'api/Albums/allDic', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * PUT api/Albums - */ - update(album?: Fonlow_PoemsApp_Data_Client.Album | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Albums', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(album) }); - } - } - - - /** - * Annotations management - */ - export class Annotations { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/Annotations - * @return {string} Type: GUID - */ - add(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Annotations', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(annotation) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Delete along with what in poemAnnotationMap. - * DELETE api/Annotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Annotations?id=' + id, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * POST api/Annotations/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Annotations/Orphaned', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(ids) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get annotation. Support ZH Convert. - * GET api/Annotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Annotations?id=' + id, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Annotations/all - */ - getAnnotationBriefs(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Annotations/all', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get all annotation briefs. Support ZH Convert. - * GET api/Annotations/allDic - */ - getAnnotationBriefsDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.AnnotationBrief }> { - return fetch(this.baseUri + 'api/Annotations/allDic', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Annotations/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Annotations/Orphaned', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Annotations/PoemCountOfAnnotations - */ - getPoemCountOfAnnotations(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Annotations/PoemCountOfAnnotations', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * PUT api/Annotations - */ - update(annotation?: Fonlow_PoemsApp_Data_Client.Annotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Annotations', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(annotation) }); - } - } - - - /** - * Annotations management - */ - export class NumberedAnnotations { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/NumberedAnnotations - * @return {string} Type: GUID - */ - add(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(numberedAnnotation) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Add multiple annotations - * POST api/NumberedAnnotations/poem/{poemId} - * @param {string} poemId Type: GUID - */ - addMuitiple(poemId?: string | null, orderNumbers?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/NumberedAnnotations/poem/' + poemId, { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(orderNumbers) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Update the orders of numbered annotations in a transaction - * PUT api/NumberedAnnotations/BulkOrderNumbers - */ - bulkUpdateOrderNumbers(idAndOrderArray?: Array<{item1: string, item2: number}> | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations/BulkOrderNumbers', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(idAndOrderArray) }); - } - - /** - * Delete along with what in poemNumberedAnnotationMap. - * DELETE api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations?id=' + id, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get numberedAnnotation. Support ZH Convert. - * GET api/NumberedAnnotations?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations?id=' + id, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Update annotation - * PUT api/NumberedAnnotations - */ - update(numberedAnnotation?: Fonlow_PoemsApp_Data_Client.NumberedAnnotation | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(numberedAnnotation) }); - } - - /** - * Update Order Number - * PUT api/NumberedAnnotations/OrderNumber?id={id}&orderNumber={orderNumber} - * @param {string} id Type: GUID - * @param {number} orderNumber Type: int, -2,147,483,648 to 2,147,483,647 - */ - updateOrderNumber(id?: string | null, orderNumber?: number | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/NumberedAnnotations/OrderNumber?id=' + id + '&orderNumber=' + orderNumber, { method: 'put', headers: headersHandler ? headersHandler() : undefined }); - } - } - - - /** - * Poems operations; associations with tags, albums and annotations. - */ - export class Poems { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * Add poem. If created is undefined, it will be now. And modified is always now. - * POST api/Poems - * @return {Fonlow_PoemsApp_Data_Client.Poem} Id of newly added - */ - add(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poem) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Add new poem with existing annotations and new annotation names. - * PUT api/Poems/AddWithExistingAnnotations - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndAnnotations new poem, existing Annotation Ids, and new annotation names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new annotation objects - */ - addWithExistingAnnotations(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/AddWithExistingAnnotations', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poemAndAnnotations) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Poem with Tags - * POST api/Poems/addWithExistingTags - */ - addWithExistingTags(poemAndTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/addWithExistingTags', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poemAndTags) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * PUT api/Poems/AddWithNewAnnotationNames - */ - addWithNewAnnotationNames(poemAndAnnotations?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/AddWithNewAnnotationNames', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poemAndAnnotations) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Add new poem with existing tags, and new tag names. - * POST api/Poems/AddWithNewTagNames - * @param {{item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array}} poemAndNewTags new poem, existing Tag Ids, and new tag names - * @return {Fonlow_PoemsApp_Data_Client.Poem} Poem Id and new tag objects - */ - addWithNewTagNames(poemAndNewTags?: {item1: Fonlow_PoemsApp_Data_Client.Poem, item2: Array} | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/AddWithNewTagNames', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poemAndNewTags) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Associate album with existing poems. - * PUT api/Poems/poemsToAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - */ - associateAlbumWithPoems(albumId?: string | null, poemIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/poemsToAlbum?albumId=' + albumId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poemIds) }); - } - - /** - * Associate with existing albums. - * PUT api/Poems/albums?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithAlbums(poemId?: string | null, albumIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/albums?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(albumIds) }); - } - - /** - * Associate with existing annotations. - * PUT api/Poems/existingAnnotations?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingAnnotations(poemId?: string | null, existingAnnotationIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/existingAnnotations?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(existingAnnotationIds) }); - } - - /** - * Associate with existing tags. - * PUT api/Poems/existingTags?poemId={poemId} - * @param {string} poemId Type: GUID - */ - associateWithExistingTags(poemId?: string | null, existingTagIds?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/existingTags?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(existingTagIds) }); - } - - /** - * Save the new annotation, and associate with the poem. - * If the annotation exists, return null. Nevertheless, the client should check if the annotation had actually been in the annotation list, to avoid exceptions. - * PUT api/Poems/newAnnotationName?poemId={poemId}&newAnnotationName={newAnnotationName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.AnnotationBrief} New annotation, or null if the annotation exists - */ - associateWithNewAnnotationName(poemId?: string | null, newAnnotationName?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/newAnnotationName?poemId=' + poemId + '&newAnnotationName=' + (!newAnnotationName ? '' : encodeURIComponent(newAnnotationName)), { method: 'put', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newAnnotationNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New annotation objects based on newAnnotationNames - */ - associateWithNewAnnotationNames(poemId?: string | null, newAnnotationNames?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/newAnnotationNames?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(newAnnotationNames) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Save the new tag, and associate with the poem. - * If the tag exists, return null. Nevertheless, the client should check if the tag had actually been in the tag list, to avoid exceptions. - * PUT api/Poems/newTagName?poemId={poemId}&newTagName={newTagName} - * @param {string} poemId Type: GUID - * @return {Fonlow_PoemsApp_Data_Client.Tag} New tag, or null if the tag exists - */ - associateWithNewTagName(poemId?: string | null, newTagName?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/newTagName?poemId=' + poemId + '&newTagName=' + (!newTagName ? '' : encodeURIComponent(newTagName)), { method: 'put', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Associate poem with new tag names. - * PUT api/Poems/newTagNames?poemId={poemId} - * @param {string} poemId Type: GUID - * @return {Array} New tag objects based on newTagNames - */ - associateWithNewTagNames(poemId?: string | null, newTagNames?: Array | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/newTagNames?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(newTagNames) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Reconcile among all images, poemImageMaps, and actually img local - * POST api/Poems/AuditAndReconcile - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - auditAndReconcile(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/AuditAndReconcile', { method: 'post', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * DELETE api/Poems/all - */ - clearAllTables(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/all', { method: 'delete', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Delete poem, along with association with albums. However, associated tags and annotations are still in maps. - * DELETE api/Poems?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems?id=' + id, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Dissociate album. - * DELETE api/Poems/DissociateAlbum?poemId={poemId}&albumId={albumId} - * @param {string} poemId Type: GUID - * @param {string} albumId Type: GUID - */ - dissociateAlbum(poemId?: string | null, albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/DissociateAlbum?poemId=' + poemId + '&albumId=' + albumId, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Disassociate annotation. - * DELETE api/Poems/DissociateAnnotation?poemId={poemId}&annotationId={annotationId} - * @param {string} poemId Type: GUID - * @param {string} annotationId Type: GUID - */ - dissociateAnnotation(poemId?: string | null, annotationId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/DissociateAnnotation?poemId=' + poemId + '&annotationId=' + annotationId, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * DissociateT tag. - * DELETE api/Poems/DissociateTag?poemId={poemId}&tagId={tagId} - * @param {string} poemId Type: GUID - * @param {string} tagId Type: GUID - */ - dissociateTag(poemId?: string | null, tagId?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/DissociateTag?poemId=' + poemId + '&tagId=' + tagId, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Fix the problem of escaped unicode string, because of the DomSanitizer of Angular. Once off solution - * PUT api/Poems/EscapeStringToUnicode - */ - escapeStringToUnicode(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/EscapeStringToUnicode', { method: 'put', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * Include TagMap and AlbumMap. Support ZH Convert. - * GET api/Poems?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems?id=' + id, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Img Src Url to multiple poem Ids - * GET api/Poems/AllNotLocalImagesOfPoems - */ - getAllNotLocalImagesOfPoems(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return fetch(this.baseUri + 'api/Poems/AllNotLocalImagesOfPoems', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Scan all poems' HTML to create mapping from imageIds to poems. Dic of imageId to poems with img local. - * POST api/Poems/AssociatedPoemsOfImages - */ - getAssociatedPoemsOfAllImages(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Array }> { - return fetch(this.baseUri + 'api/Poems/AssociatedPoemsOfImages', { method: 'post', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * All, OrderByDescending published. Support ZH Convert. If the user is not loggedin, not returning those not yet published. - * GET api/Poems/AllBriefs - * @param {number} timezoneOffset int in header - */ - getBriefsOfPoems(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/AllBriefs', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * All poems of album, order by published. Support ZH Convert. - * GET api/Poems/GetOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {string} convertZH string in header - * @param {number} timezoneOffset int in header - */ - getOfAlbum(albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/GetOfAlbum?albumId=' + albumId, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/GetPoemBriefsOfAlbum?albumId={albumId} - * @param {string} albumId Type: GUID - * @param {number} timezoneOffset int in header - */ - getPoemBriefsOfAlbum(albumId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/GetPoemBriefsOfAlbum?albumId=' + albumId, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/PoemCollection - */ - getPoemCollection(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/PoemCollection', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionInOtherChineseWriting - */ - getPoemCollectionInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/PoemCollectionInOtherChineseWriting', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublished - * @param {number} timezoneOffset In request headers - */ - getPoemCollectionPublished(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/PoemCollectionPublished', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/PoemCollectionPublishedInOtherChineseWriting - * @param {number} timezoneOffset timezoneOffset in headers - */ - getPoemCollectionPublishedInOtherChineseWriting(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/PoemCollectionPublishedInOtherChineseWriting', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/PoemsWithInternalImageId?imageId={imageId} - * @param {string} imageId Type: GUID - */ - getPoemsWithInternalImageId(imageId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/PoemsWithInternalImageId?imageId=' + imageId, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Poems/TotalCountOfStanza - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getTotalCountOfStanza(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/TotalCountOfStanza', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * POST api/Poems/PoemCollection - */ - importPoemCollection(collection?: Fonlow_PoemsApp_Data_Client.PoemCollection | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/PoemCollection', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(collection) }); - } - - /** - * GET api/Poems/ByAnnotation?annotationId={annotationId} - * @param {string} annotationId Type: GUID - */ - searchByAnnotation(annotationId?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/ByAnnotation?annotationId=' + annotationId, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Search by keywords, separated by comma and Chinese comma. Support ZH Convert. - * POST api/Poems/ByKeywords - * @param {number} timezoneOffset int in header - */ - searchByKeywords(keywords?: string | null, headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Poems/ByKeywords', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(keywords) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Update poem. - * PUT api/Poems - */ - update(poem?: Fonlow_PoemsApp_Data_Client.Poem | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(poem) }); - } - - /** - * Just for maintenance, while the plaintext should be produced in the frontend. - * POST api/Poems/UpdatePlainTextOfHtmlPoems - */ - updatePlainTextOfHtmlPoems(headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/UpdatePlainTextOfHtmlPoems', { method: 'post', headers: headersHandler ? headersHandler() : undefined }); - } - - /** - * PUT api/Poems/UpdatePublished?poemId={poemId} - * @param {string} poemId Type: GUID - */ - updatePublished(poemId?: string | null, dt?: Date | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Poems/UpdatePublished?poemId=' + poemId, { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(dt) }); - } - } - - - /** - * Tags management - */ - export class Tags { - constructor(private baseUri: string = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/') { - } - - /** - * POST api/Tags - * @return {string} Type: GUID - */ - add(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Tags', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(tag) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Delete along with what in poemTagMap. - * DELETE api/Tags?id={id} - * @param {string} id Type: GUID - */ - delete(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Tags?id=' + id, { method: 'delete', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * POST api/Tags/Orphaned - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - deleteOrphaned(ids?: Array | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Tags/Orphaned', { method: 'post', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(ids) }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get tag. Support ZH Convert. - * GET api/Tags?id={id} - * @param {string} id Type: GUID - */ - get(id?: string | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Tags?id=' + id, { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get all tags. Support ZH Convert. - * GET api/Tags/all - */ - getAll(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Tags/all', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * Get all tags as dictionary. Support ZH Convert. - * GET api/Tags/allDic - */ - getAllDic(headersHandler?: () => {[header: string]: string}): Promise<{[id: string]: Fonlow_PoemsApp_Data_Client.Tag }> { - return fetch(this.baseUri + 'api/Tags/allDic', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Tags/Orphaned - */ - getOrphaned(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Tags/Orphaned', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * GET api/Tags/PoemCountOfTags - */ - getPoemCountOfTags(headersHandler?: () => {[header: string]: string}): Promise> { - return fetch(this.baseUri + 'api/Tags/PoemCountOfTags', { method: 'get', headers: headersHandler ? headersHandler() : undefined }).then(d => {if (d.status<=202) return d.json(); else if (d.status==204) return null; throw d;}); - } - - /** - * PUT api/Tags - */ - update(tag?: Fonlow_PoemsApp_Data_Client.Tag | null, headersHandler?: () => {[header: string]: string}): Promise { - return fetch(this.baseUri + 'api/Tags', { method: 'put', headers: headersHandler ? Object.assign(headersHandler(), { 'Content-Type': 'application/json;charset=UTF-8' }): { 'Content-Type': 'application/json;charset=UTF-8' }, body: JSON.stringify(tag) }); - } - } - -} -