Skip to content

Commit

Permalink
feat(file-value): support all file value types (DSP-1777) (#352)
Browse files Browse the repository at this point in the history
* feat(file-value): support all file value types (DSP-1777)

* refactor(value): export file values
  • Loading branch information
kilchenmann authored Jul 7, 2021
1 parent b349ece commit 7af80b2
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,23 @@ export { ReadBooleanValue } from "./models/v2/resources/values/read/read-boolean
export { ReadColorValue } from "./models/v2/resources/values/read/read-color-value";
export { ReadDateValue, KnoraDate, KnoraPeriod, Precision } from "./models/v2/resources/values/read/read-date-value";
export { ReadDecimalValue } from "./models/v2/resources/values/read/read-decimal-value";
export { ReadFileValue, ReadStillImageFileValue } from "./models/v2/resources/values/read/read-file-value";
export {
ReadFileValue,
ReadAudioFileValue,
ReadDocumentFileValue,
ReadMovingImageFileValue,
ReadStillImageFileValue
} from "./models/v2/resources/values/read/read-file-value";
export { ReadGeomValue, RegionGeometry, Point2D } from "./models/v2/resources/values/read/read-geom-value";
export { ReadIntValue } from "./models/v2/resources/values/read/read-int-value";
export { ReadIntervalValue } from "./models/v2/resources/values/read/read-interval-value";
export { ReadLinkValue } from "./models/v2/resources/values/read/read-link-value";
export { ReadListValue } from "./models/v2/resources/values/read/read-list-value";
export {
ReadTextValue, ReadTextValueAsString, ReadTextValueAsHtml, ReadTextValueAsXml
ReadTextValue,
ReadTextValueAsString,
ReadTextValueAsHtml,
ReadTextValueAsXml
} from "./models/v2/resources/values/read/read-text-value";
export { ReadUriValue } from "./models/v2/resources/values/read/read-uri-value";
export { ReadTimeValue } from "./models/v2/resources/values/read/read-time-value";
Expand All @@ -173,8 +182,14 @@ export { UpdateBooleanValue } from "./models/v2/resources/values/update/update-b
export { UpdateColorValue } from "./models/v2/resources/values/update/update-color-value";
export { UpdateDateValue } from "./models/v2/resources/values/update/update-date-value";
export { UpdateDecimalValue } from "./models/v2/resources/values/update/update-decimal-value";
export { UpdateFileValue } from "./models/v2/resources/values/update/update-file-value";
export { UpdateStillImageFileValue } from "./models/v2/resources/values/update/update-file-value";
export {
UpdateFileValue,
UpdateAudioFileValue,
UpdateDocumentFileValue,
UpdateMovingImageFileValue,
UpdateStillImageFileValue,
UpdateTextFileValue
} from "./models/v2/resources/values/update/update-file-value";
export { UpdateGeomValue } from "./models/v2/resources/values/update/update-geom-value";
export { UpdateIntValue } from "./models/v2/resources/values/update/update-int-value";
export { UpdateIntervalValue } from "./models/v2/resources/values/update/update-interval-value";
Expand All @@ -190,8 +205,14 @@ export { CreateBooleanValue } from "./models/v2/resources/values/create/create-b
export { CreateColorValue } from "./models/v2/resources/values/create/create-color-value";
export { CreateDateValue } from "./models/v2/resources/values/create/create-date-value";
export { CreateDecimalValue } from "./models/v2/resources/values/create/create-decimal-value";
export { CreateFileValue } from "./models/v2/resources/values/create/create-file-value";
export { CreateStillImageFileValue } from "./models/v2/resources/values/create/create-file-value";
export {
CreateFileValue,
CreateAudioFileValue,
CreateDocumentFileValue,
CreateMovingImageFileValue,
CreateStillImageFileValue,
CreateTextFileValue
} from "./models/v2/resources/values/create/create-file-value";
export { CreateGeomValue } from "./models/v2/resources/values/create/create-geom-value";
export { CreateIntValue } from "./models/v2/resources/values/create/create-int-value";
export { CreateIntervalValue } from "./models/v2/resources/values/create/create-interval-value";
Expand Down
3 changes: 3 additions & 0 deletions src/models/v2/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export class Constants {
static LinkValueHasSourceIri = Constants.KnoraApiV2 + Constants.HashDelimiter + "linkValueHasSourceIri";
static UriValueAsUri = Constants.KnoraApiV2 + Constants.HashDelimiter + "uriValueAsUri";
static GeometryValueAsGeometry = Constants.KnoraApiV2 + Constants.HashDelimiter + "geometryValueAsGeometry";
static DocumentFileValueHasDimX = Constants.KnoraApiV2 + Constants.HashDelimiter + "documentFileValueHasDimX";
static DocumentFileValueHasDimY = Constants.KnoraApiV2 + Constants.HashDelimiter + "documentFileValueHasDimY";
static DocumentFileValueHasPageCount = Constants.KnoraApiV2 + Constants.HashDelimiter + "documentFileValueHasPageCount";
static StillImageFileValueHasDimX = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasDimX";
static StillImageFileValueHasDimY = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasDimY";
static StillImageFileValueHasIIIFBaseUrl = Constants.KnoraApiV2 + Constants.HashDelimiter + "stillImageFileValueHasIIIFBaseUrl";
Expand Down
48 changes: 48 additions & 0 deletions src/models/v2/resources/values/create/create-file-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,42 @@ export abstract class CreateFileValue extends CreateValue implements IBaseFileVa
filename: string = "";
}

/**
* @category Model V2
*/
@JsonObject("CreateAudioFileValue")
export class CreateAudioFileValue extends CreateFileValue {

constructor() {
super(Constants.AudioFileValue);
}

}

/**
* @category Model V2
*/
@JsonObject("CreateDocumentFileValue")
export class CreateDocumentFileValue extends CreateFileValue {

constructor() {
super(Constants.DocumentFileValue);
}

}

/**
* @category Model V2
*/
@JsonObject("CreateMovingImageFileValue")
export class CreateMovingImageFileValue extends CreateFileValue {

constructor() {
super(Constants.MovingImageFileValue);
}

}

/**
* @category Model V2
*/
Expand All @@ -23,3 +59,15 @@ export class CreateStillImageFileValue extends CreateFileValue {
}

}

/**
* @category Model V2
*/
@JsonObject("CreateTextFileValue")
export class CreateTextFileValue extends CreateFileValue {

constructor() {
super(Constants.TextFileValue);
}

}
48 changes: 48 additions & 0 deletions src/models/v2/resources/values/read/read-file-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,54 @@ export abstract class ReadFileValue extends ReadValue implements IBaseFileValue
fileUrl: string = "";
}

/**
* @category Model V2
*/
@JsonObject("ReadAudioFileValue")
export class ReadAudioFileValue extends ReadFileValue {

@JsonProperty(Constants.AudioFileValueHasDuration, Number)
duration: number = 0;

}

/**
* @category Model V2
*/
@JsonObject("ReadDocumentFileValue")
export class ReadDocumentFileValue extends ReadFileValue {

@JsonProperty(Constants.DocumentFileValueHasDimX, Number)
dimX: number = 0;

@JsonProperty(Constants.DocumentFileValueHasDimY, Number)
dimY: number = 0;

@JsonProperty(Constants.DocumentFileValueHasPageCount, Number)
pageCount: number = 0;

}

/**
* @category Model V2
*/
@JsonObject("ReadMovingImageFileValue")
export class ReadMovingImageFileValue extends ReadFileValue {

@JsonProperty(Constants.MovingImageFileValueHasDimX, Number)
dimX: number = 0;

@JsonProperty(Constants.MovingImageFileValueHasDimY, Number)
dimY: number = 0;

@JsonProperty(Constants.MovingImageFileValueHasDuration, Number)
duration: number = 0;

@JsonProperty(Constants.MovingImageFileValueHasFps, Number)
fps: number = 0;

}

/**
* @category Model V2
*/
Expand Down
49 changes: 49 additions & 0 deletions src/models/v2/resources/values/update/update-file-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,42 @@ export abstract class UpdateFileValue extends UpdateValue implements IBaseFileVa

}

/**
* @category Model V2
*/
@JsonObject("UpdateAudioFileValue")
export class UpdateAudioFileValue extends UpdateFileValue {

constructor() {
super(Constants.AudioFileValue);
}

}

/**
* @category Model V2
*/
@JsonObject("UpdateDocumentFileValue")
export class UpdateDocumentFileValue extends UpdateFileValue {

constructor() {
super(Constants.DocumentFileValue);
}

}

/**
* @category Model V2
*/
@JsonObject("UpdateMovingImageFileValue")
export class UpdateMovingImageFileValue extends UpdateFileValue {

constructor() {
super(Constants.MovingImageFileValue);
}

}

/**
* @category Model V2
*/
Expand All @@ -25,3 +61,16 @@ export class UpdateStillImageFileValue extends UpdateFileValue {
}

}

/**
* @category Model V2
*/
@JsonObject("UpdateTextFileValue")
export class UpdateTextFileValue extends UpdateFileValue {

constructor() {
super(Constants.TextFileValue);
}

}

0 comments on commit 7af80b2

Please sign in to comment.