mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-06-11 17:10:23 +00:00
* Add OpenAPIDocs * Remove the json prefix from the names * Format file * Rename models to schemas * Add required = true to all the required attributes * Add missing required = true schemas * Deprecated fields are not required * switch to micronout json generation * Fix generator for JsonUnwrapped files * Fix layout of manual schemas * Pretty print the json files * Remove @JsonProperty(required = true) * Make references local * Updated the readme * Removed uneeded import * Remove extra empty lines * Clean readme * Add docs depedency only when needed * Revert uneeded changes * Revert more changes * Better formatting * Simplified name * fix: remove jsonunwrapped workaround by upgrading to micronaut-json-schema version 2.0.0-M6 * Simplified jsonSchemas task definition * Updated readme with the new schemas path * typo fixing * Remove empty space from merge
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package org.asamk.signal.json;
|
|
|
|
import io.micronaut.jsonschema.JsonSchema;
|
|
|
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
|
|
|
@JsonSchema(title = "Attachment")
|
|
record JsonAttachment(
|
|
String contentType,
|
|
String filename,
|
|
String id,
|
|
Long size,
|
|
Integer width,
|
|
Integer height,
|
|
String caption,
|
|
Long uploadTimestamp
|
|
) {
|
|
|
|
static JsonAttachment from(MessageEnvelope.Data.Attachment attachment) {
|
|
final var id = attachment.id().orElse(null);
|
|
final var filename = attachment.fileName().orElse(null);
|
|
final var size = attachment.size().orElse(null);
|
|
final var width = attachment.width().orElse(null);
|
|
final var height = attachment.height().orElse(null);
|
|
final var caption = attachment.caption().orElse(null);
|
|
final var uploadTimestamp = attachment.uploadTimestamp().orElse(null);
|
|
|
|
return new JsonAttachment(attachment.contentType(),
|
|
filename,
|
|
id,
|
|
size,
|
|
width,
|
|
height,
|
|
caption,
|
|
uploadTimestamp);
|
|
}
|
|
}
|