From 5f5dc105b48073c9e52b535bd4f41e31c9982458 Mon Sep 17 00:00:00 2001 From: domsteinbach Date: Mon, 5 Aug 2024 17:12:05 +0200 Subject: [PATCH] refactor(external iiif url): differentiate between reading and creating acc. to the api --- src/index.ts | 1 + src/models/v2/Constants.ts | 1 + src/models/v2/resources/values/create/create-file-value.ts | 4 +++- src/models/v2/resources/values/read/read-file-value.ts | 6 +----- src/models/v2/resources/values/update/update-file-value.ts | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index 801116fba..3ee333abc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -232,6 +232,7 @@ export { CreateDocumentFileValue, CreateMovingImageFileValue, CreateStillImageFileValue, + CreateStillImageExternalFileValue, CreateTextFileValue, CreateArchiveFileValue } from "./models/v2/resources/values/create/create-file-value"; diff --git a/src/models/v2/Constants.ts b/src/models/v2/Constants.ts index 76368d3c6..f0e661b88 100644 --- a/src/models/v2/Constants.ts +++ b/src/models/v2/Constants.ts @@ -129,6 +129,7 @@ export class Constants { static StillImageFileValueHasDimX = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasDimX"; static StillImageFileValueHasDimY = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasDimY"; static StillImageFileValueHasIIIFBaseUrl = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasIIIFBaseUrl"; + static FileValueHasExternalUrl = Constants.KnoraApiV2 + Constants.HashDelimiter + "fileValueHasExternalUrl"; static StillImageFileValueHasExternalUrl = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasExternalUrl"; static AudioFileValueHasDuration = Constants.KnoraApiV2 + Constants.HashDelimiter + "audioFileValueHasDuration"; static MovingImageFileValueHasDimX = Constants.KnoraApiV2 + Constants.HashDelimiter + "movingImageFileValueHasDimX"; diff --git a/src/models/v2/resources/values/create/create-file-value.ts b/src/models/v2/resources/values/create/create-file-value.ts index 8ff567c75..6ff7dd181 100644 --- a/src/models/v2/resources/values/create/create-file-value.ts +++ b/src/models/v2/resources/values/create/create-file-value.ts @@ -56,6 +56,7 @@ export class CreateStillImageFileValue extends CreateFileValue { constructor() { super(Constants.StillImageFileValue); + } } @@ -65,7 +66,8 @@ export class CreateStillImageFileValue extends CreateFileValue { */ @JsonObject("CreateStillImageExternalFileValue") export class CreateStillImageExternalFileValue extends CreateFileValue { - + @JsonProperty(Constants.FileValueHasExternalUrl, String, true) + externalUrl?: string = ""; constructor() { super(Constants.StillImageExternalFileValue); } diff --git a/src/models/v2/resources/values/read/read-file-value.ts b/src/models/v2/resources/values/read/read-file-value.ts index 88d50f29a..0b0b45089 100644 --- a/src/models/v2/resources/values/read/read-file-value.ts +++ b/src/models/v2/resources/values/read/read-file-value.ts @@ -87,11 +87,7 @@ export class ReadStillImageFileValue extends ReadFileValue { */ @JsonObject("ReadStillImageExternalFileValue") export class ReadStillImageExternalFileValue extends ReadFileValue { - - @JsonProperty(Constants.StillImageFileValueHasIIIFBaseUrl, UriConverter) - iiifBaseUrl: string = ""; - - @JsonProperty(Constants.StillImageFileValueHasExternalUrl, UriConverter) + @JsonProperty(Constants.StillImageFileValueHasExternalUrl, UriConverter, true) externalUrl: string = ""; } diff --git a/src/models/v2/resources/values/update/update-file-value.ts b/src/models/v2/resources/values/update/update-file-value.ts index 4dfcf5008..4229bea16 100644 --- a/src/models/v2/resources/values/update/update-file-value.ts +++ b/src/models/v2/resources/values/update/update-file-value.ts @@ -67,11 +67,11 @@ export class UpdateStillImageFileValue extends UpdateFileValue { */ @JsonObject("UpdateStillImageExternalFileValue") export class UpdateExternalStillImageFileValue extends UpdateFileValue { - + @JsonProperty(Constants.StillImageFileValueHasExternalUrl, String, true) + externalUrl?: string = ""; constructor() { - super(Constants.StillImageExternalFileValue); + super(Constants.StillImageAbstractFileValue); } - }