mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-03-14 02:30:15 +00:00
switch to micronout json generation
This commit is contained in:
parent
3f15de0946
commit
cde6fff336
@ -1,3 +1,5 @@
|
||||
https://sdkman.io/usage/
|
||||
|
||||
# signal-cli
|
||||
|
||||
signal-cli is a commandline interface for the [Signal messenger](https://signal.org/).
|
||||
@ -153,13 +155,10 @@ version installed, you can replace `./gradlew` with `gradle` in the following st
|
||||
1. Run documentation server for all the JSON-RPC schemas (`src/main/java/org/asamk/signal/json`):
|
||||
|
||||
```sh
|
||||
./gradlew openApiDocs
|
||||
./gradlew genJsonSchemas
|
||||
```
|
||||
|
||||
2. Open:
|
||||
|
||||
- `http://localhost:8080/swagger-ui/index.html` (Swagger UI)
|
||||
- `http://localhost:8080/v3/api-docs/json-models` (OpenAPI JSON)
|
||||
2. Check the json schemas files in the following folder:
|
||||
|
||||
### Building a native binary with GraalVM (EXPERIMENTAL)
|
||||
|
||||
|
||||
@ -82,6 +82,9 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
annotationProcessor(libs.micronaut.json.schema.processor)
|
||||
annotationProcessor(libs.micronaut.inject.java)
|
||||
|
||||
implementation(libs.bouncycastle)
|
||||
implementation(libs.jackson.databind)
|
||||
implementation(libs.argparse4j)
|
||||
@ -90,8 +93,8 @@ dependencies {
|
||||
implementation(libs.slf4j.jul)
|
||||
implementation(libs.logback)
|
||||
implementation(libs.zxing)
|
||||
implementation(libs.spring.boot.starter.web)
|
||||
implementation(libs.springdoc.openapi.starter.webmvc.ui)
|
||||
implementation(libs.micronaut.json.schema.annotations)
|
||||
implementation(libs.micronaut.json.schema.generator)
|
||||
implementation(project(":libsignal-cli"))
|
||||
}
|
||||
|
||||
@ -107,8 +110,16 @@ tasks.withType<AbstractArchiveTask>().configureEach {
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.addAll(
|
||||
listOf(
|
||||
"-Amicronaut.processing.group=org.asamk",
|
||||
"-Amicronaut.processing.module=signal-cli",
|
||||
"-Amicronaut.processing.annotations=org.asamk.signal.json.*",
|
||||
"-Amicronaut.jsonschema.baseUri=https://example.com/schemas",
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
tasks.withType<Jar> {
|
||||
@ -141,9 +152,8 @@ tasks.register("fatJar", type = Jar::class) {
|
||||
with(tasks.jar.get())
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("openApiDocs") {
|
||||
tasks.register("genJsonSchemas") {
|
||||
group = "application"
|
||||
description = "Run OpenAPI documentation server for JSON models"
|
||||
classpath = sourceSets["main"].runtimeClasspath
|
||||
mainClass.set("org.asamk.signal.openapi.OpenApiDocumentationApplication")
|
||||
description = "Generate JSON schemas using annotation processing"
|
||||
dependsOn(tasks.compileJava)
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
[versions]
|
||||
slf4j = "2.0.17"
|
||||
junit = "6.0.2"
|
||||
spring-boot = "3.5.0"
|
||||
springdoc = "2.8.13"
|
||||
micronaut-json-schema = "1.7.2"
|
||||
micronaut-core = "4.9.3"
|
||||
|
||||
[libraries]
|
||||
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.83"
|
||||
@ -10,8 +10,10 @@ jackson-databind = "com.fasterxml.jackson.core:jackson-databind:2.20.2"
|
||||
argparse4j = "net.sourceforge.argparse4j:argparse4j:0.9.0"
|
||||
dbusjava = "com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.0.0"
|
||||
zxing = "com.google.zxing:core:3.5.4"
|
||||
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "spring-boot" }
|
||||
springdoc-openapi-starter-webmvc-ui = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
|
||||
micronaut-json-schema-annotations = { module = "io.micronaut.jsonschema:micronaut-json-schema-annotations", version.ref = "micronaut-json-schema" }
|
||||
micronaut-json-schema-processor = { module = "io.micronaut.jsonschema:micronaut-json-schema-processor", version.ref = "micronaut-json-schema" }
|
||||
micronaut-json-schema-generator = { module = "io.micronaut.jsonschema:micronaut-json-schema-generator", version.ref = "micronaut-json-schema" }
|
||||
micronaut-inject-java = { module = "io.micronaut:micronaut-inject-java", version.ref = "micronaut-core" }
|
||||
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
||||
logback = "ch.qos.logback:logback-classic:1.5.32"
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "AdminDelete")
|
||||
@JsonSchema(title = "AdminDelete")
|
||||
public record JsonAdminDelete(
|
||||
@Deprecated String targetAuthor,
|
||||
@Schema(required = true) String targetAuthorNumber,
|
||||
@Schema(required = true) String targetAuthorUuid,
|
||||
@Schema(required = true) long targetSentTimestamp
|
||||
@JsonProperty(required = true) String targetAuthorNumber,
|
||||
@JsonProperty(required = true) String targetAuthorUuid,
|
||||
@JsonProperty(required = true) long targetSentTimestamp
|
||||
) {
|
||||
|
||||
static JsonAdminDelete from(MessageEnvelope.Data.AdminDelete adminDelete) {
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "Attachment")
|
||||
@JsonSchema(title = "Attachment")
|
||||
record JsonAttachment(
|
||||
@Schema(required = true) String contentType,
|
||||
@Schema(required = true) String filename,
|
||||
@Schema(required = true) String id,
|
||||
@Schema(required = true) Long size,
|
||||
@Schema(required = true) Integer width,
|
||||
@Schema(required = true) Integer height,
|
||||
@Schema(required = true) String caption,
|
||||
@Schema(required = true) Long uploadTimestamp
|
||||
@JsonProperty(required = true) String contentType,
|
||||
@JsonProperty(required = true) String filename,
|
||||
@JsonProperty(required = true) String id,
|
||||
@JsonProperty(required = true) Long size,
|
||||
@JsonProperty(required = true) Integer width,
|
||||
@JsonProperty(required = true) Integer height,
|
||||
@JsonProperty(required = true) String caption,
|
||||
@JsonProperty(required = true) Long uploadTimestamp
|
||||
) {
|
||||
|
||||
static JsonAttachment from(MessageEnvelope.Data.Attachment attachment) {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
@Schema(name = "AttachmentData")
|
||||
|
||||
@JsonSchema(title = "AttachmentData")
|
||||
public record JsonAttachmentData(
|
||||
@Schema(required = true) String data
|
||||
@JsonProperty(required = true) String data
|
||||
) {}
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "CallMessage")
|
||||
@JsonSchema(title = "CallMessage")
|
||||
record JsonCallMessage(
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) Offer offerMessage,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) Answer answerMessage,
|
||||
@ -26,9 +27,9 @@ record JsonCallMessage(
|
||||
}
|
||||
|
||||
record Offer(
|
||||
@Schema(required = true) long id,
|
||||
@Schema(required = true) String type,
|
||||
@Schema(required = true) String opaque
|
||||
@JsonProperty(required = true) long id,
|
||||
@JsonProperty(required = true) String type,
|
||||
@JsonProperty(required = true) String opaque
|
||||
) {
|
||||
|
||||
public static Offer from(final MessageEnvelope.Call.Offer offer) {
|
||||
@ -37,8 +38,8 @@ record JsonCallMessage(
|
||||
}
|
||||
|
||||
public record Answer(
|
||||
@Schema(required = true) long id,
|
||||
@Schema(required = true) String opaque
|
||||
@JsonProperty(required = true) long id,
|
||||
@JsonProperty(required = true) String opaque
|
||||
) {
|
||||
|
||||
public static Answer from(final MessageEnvelope.Call.Answer answer) {
|
||||
@ -46,7 +47,7 @@ record JsonCallMessage(
|
||||
}
|
||||
}
|
||||
|
||||
public record Busy(@Schema(required = true) long id) {
|
||||
public record Busy(@JsonProperty(required = true) long id) {
|
||||
|
||||
public static Busy from(final MessageEnvelope.Call.Busy busy) {
|
||||
return new Busy(busy.id());
|
||||
@ -54,9 +55,9 @@ record JsonCallMessage(
|
||||
}
|
||||
|
||||
public record Hangup(
|
||||
@Schema(required = true) long id,
|
||||
@Schema(required = true) String type,
|
||||
@Schema(required = true) int deviceId
|
||||
@JsonProperty(required = true) long id,
|
||||
@JsonProperty(required = true) String type,
|
||||
@JsonProperty(required = true) int deviceId
|
||||
) {
|
||||
|
||||
public static Hangup from(final MessageEnvelope.Call.Hangup hangup) {
|
||||
@ -65,8 +66,8 @@ record JsonCallMessage(
|
||||
}
|
||||
|
||||
public record IceUpdate(
|
||||
@Schema(required = true) long id,
|
||||
@Schema(required = true) String opaque
|
||||
@JsonProperty(required = true) long id,
|
||||
@JsonProperty(required = true) String opaque
|
||||
) {
|
||||
|
||||
public static IceUpdate from(final MessageEnvelope.Call.IceUpdate iceUpdate) {
|
||||
|
||||
@ -1,48 +1,50 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "Contact")
|
||||
@JsonSchema(title = "Contact")
|
||||
public record JsonContact(
|
||||
@Schema(required = true) String number,
|
||||
@Schema(required = true) String uuid,
|
||||
@Schema(required = true) String username,
|
||||
@Schema(required = true) String name,
|
||||
@Schema(required = true) String givenName,
|
||||
@Schema(required = true) String familyName,
|
||||
@Schema(required = true) String nickName,
|
||||
@Schema(required = true) String nickGivenName,
|
||||
@Schema(required = true) String nickFamilyName,
|
||||
@Schema(required = true) String note,
|
||||
@Schema(required = true) String color,
|
||||
@Schema(required = true) boolean isBlocked,
|
||||
@Schema(required = true) boolean isHidden,
|
||||
@Schema(required = true) int messageExpirationTime,
|
||||
@Schema(required = true) boolean profileSharing,
|
||||
@Schema(required = true) boolean unregistered,
|
||||
@Schema(required = true) JsonProfile profile,
|
||||
@JsonProperty(required = true) String number,
|
||||
@JsonProperty(required = true) String uuid,
|
||||
@JsonProperty(required = true) String username,
|
||||
@JsonProperty(required = true) String name,
|
||||
@JsonProperty(required = true) String givenName,
|
||||
@JsonProperty(required = true) String familyName,
|
||||
@JsonProperty(required = true) String nickName,
|
||||
@JsonProperty(required = true) String nickGivenName,
|
||||
@JsonProperty(required = true) String nickFamilyName,
|
||||
@JsonProperty(required = true) String note,
|
||||
@JsonProperty(required = true) String color,
|
||||
@JsonProperty(required = true) boolean isBlocked,
|
||||
@JsonProperty(required = true) boolean isHidden,
|
||||
@JsonProperty(required = true) int messageExpirationTime,
|
||||
@JsonProperty(required = true) boolean profileSharing,
|
||||
@JsonProperty(required = true) boolean unregistered,
|
||||
@JsonProperty(required = true) JsonProfile profile,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonInternal internal
|
||||
) {
|
||||
|
||||
@Schema(name = "Profile")
|
||||
@JsonSchema(title = "Profile")
|
||||
public record JsonProfile(
|
||||
@Schema(required = true) long lastUpdateTimestamp,
|
||||
@Schema(required = true) String givenName,
|
||||
@Schema(required = true) String familyName,
|
||||
@Schema(required = true) String about,
|
||||
@Schema(required = true) String aboutEmoji,
|
||||
@Schema(required = true) boolean hasAvatar,
|
||||
@Schema(required = true) String mobileCoinAddress
|
||||
@JsonProperty(required = true) long lastUpdateTimestamp,
|
||||
@JsonProperty(required = true) String givenName,
|
||||
@JsonProperty(required = true) String familyName,
|
||||
@JsonProperty(required = true) String about,
|
||||
@JsonProperty(required = true) String aboutEmoji,
|
||||
@JsonProperty(required = true) boolean hasAvatar,
|
||||
@JsonProperty(required = true) String mobileCoinAddress
|
||||
) {}
|
||||
|
||||
@Schema(name = "Internal")
|
||||
@JsonSchema(title = "Internal")
|
||||
public record JsonInternal(
|
||||
@Schema(required = true) List<String> capabilities,
|
||||
@Schema(required = true) String unidentifiedAccessMode,
|
||||
@Schema(required = true) Boolean sharesPhoneNumber,
|
||||
@Schema(required = true) Boolean discoverableByPhonenumber
|
||||
@JsonProperty(required = true) List<String> capabilities,
|
||||
@JsonProperty(required = true) String unidentifiedAccessMode,
|
||||
@JsonProperty(required = true) Boolean sharesPhoneNumber,
|
||||
@JsonProperty(required = true) Boolean discoverableByPhonenumber
|
||||
) {}
|
||||
}
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
@Schema(name = "ContactAddress")
|
||||
@JsonSchema(title = "ContactAddress")
|
||||
public record JsonContactAddress(
|
||||
@Schema(required = true) String type,
|
||||
@Schema(required = true) String label,
|
||||
@Schema(required = true) String street,
|
||||
@Schema(required = true) String pobox,
|
||||
@Schema(required = true) String neighborhood,
|
||||
@Schema(required = true) String city,
|
||||
@Schema(required = true) String region,
|
||||
@Schema(required = true) String postcode,
|
||||
@Schema(required = true) String country
|
||||
@JsonProperty(required = true) String type,
|
||||
@JsonProperty(required = true) String label,
|
||||
@JsonProperty(required = true) String street,
|
||||
@JsonProperty(required = true) String pobox,
|
||||
@JsonProperty(required = true) String neighborhood,
|
||||
@JsonProperty(required = true) String city,
|
||||
@JsonProperty(required = true) String region,
|
||||
@JsonProperty(required = true) String postcode,
|
||||
@JsonProperty(required = true) String country
|
||||
) {
|
||||
|
||||
static JsonContactAddress from(MessageEnvelope.Data.SharedContact.Address address) {
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "ContactAvatar")
|
||||
@JsonSchema(title = "ContactAvatar")
|
||||
public record JsonContactAvatar(
|
||||
@Schema(required = true) JsonAttachment attachment,
|
||||
@Schema(required = true) boolean isProfile
|
||||
@JsonProperty(required = true) JsonAttachment attachment,
|
||||
@JsonProperty(required = true) boolean isProfile
|
||||
) {
|
||||
|
||||
static JsonContactAvatar from(MessageEnvelope.Data.SharedContact.Avatar avatar) {
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
@Schema(name = "ContactEmail")
|
||||
@JsonSchema(title = "ContactEmail")
|
||||
public record JsonContactEmail(
|
||||
@Schema(required = true) String value,
|
||||
@Schema(required = true) String type,
|
||||
@Schema(required = true) String label
|
||||
@JsonProperty(required = true) String value,
|
||||
@JsonProperty(required = true) String type,
|
||||
@JsonProperty(required = true) String label
|
||||
) {
|
||||
|
||||
static JsonContactEmail from(MessageEnvelope.Data.SharedContact.Email email) {
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
@Schema(name = "ContactName")
|
||||
@JsonSchema(title = "ContactName")
|
||||
public record JsonContactName(
|
||||
@Schema(required = true) String nickname,
|
||||
@Schema(required = true) String given,
|
||||
@Schema(required = true) String family,
|
||||
@Schema(required = true) String prefix,
|
||||
@Schema(required = true) String suffix,
|
||||
@Schema(required = true) String middle
|
||||
@JsonProperty(required = true) String nickname,
|
||||
@JsonProperty(required = true) String given,
|
||||
@JsonProperty(required = true) String family,
|
||||
@JsonProperty(required = true) String prefix,
|
||||
@JsonProperty(required = true) String suffix,
|
||||
@JsonProperty(required = true) String middle
|
||||
) {
|
||||
|
||||
static JsonContactName from(MessageEnvelope.Data.SharedContact.Name name) {
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Util;
|
||||
|
||||
@Schema(name = "ContactPhone")
|
||||
@JsonSchema(title = "ContactPhone")
|
||||
public record JsonContactPhone(
|
||||
@Schema(required = true) String value,
|
||||
@Schema(required = true) String type,
|
||||
@Schema(required = true) String label
|
||||
@JsonProperty(required = true) String value,
|
||||
@JsonProperty(required = true) String type,
|
||||
@JsonProperty(required = true) String label
|
||||
) {
|
||||
|
||||
static JsonContactPhone from(MessageEnvelope.Data.SharedContact.Phone phone) {
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "DataMessage")
|
||||
@JsonSchema(title = "DataMessage")
|
||||
record JsonDataMessage(
|
||||
@Schema(required = true) long timestamp,
|
||||
@Schema(required = true) String message,
|
||||
@Schema(required = true) Integer expiresInSeconds,
|
||||
@JsonProperty(required = true) long timestamp,
|
||||
@JsonProperty(required = true) String message,
|
||||
@JsonProperty(required = true) Integer expiresInSeconds,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) Boolean isExpirationUpdate,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) Boolean viewOnce,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonReaction reaction,
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "EditMessage")
|
||||
@JsonSchema(title = "EditMessage")
|
||||
record JsonEditMessage(
|
||||
@Schema(required = true) long targetSentTimestamp,
|
||||
@Schema(required = true) JsonDataMessage dataMessage
|
||||
@JsonProperty(required = true) long targetSentTimestamp,
|
||||
@JsonProperty(required = true) JsonDataMessage dataMessage
|
||||
) {
|
||||
|
||||
static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
@Schema(name = "Error")
|
||||
public record JsonError(@Schema(required = true) String message, @Schema(required = true) String type) {
|
||||
|
||||
@JsonSchema(title = "Error")
|
||||
public record JsonError(@JsonProperty(required = true) String message, @JsonProperty(required = true) String type) {
|
||||
|
||||
public static JsonError from(Throwable exception) {
|
||||
return new JsonError(exception.getMessage(), exception.getClass().getSimpleName());
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "GroupInfo")
|
||||
@JsonSchema(title = "GroupInfo")
|
||||
record JsonGroupInfo(
|
||||
@Schema(required = true) String groupId,
|
||||
@Schema(required = true) String groupName,
|
||||
@Schema(required = true) int revision,
|
||||
@Schema(required = true) String type
|
||||
@JsonProperty(required = true) String groupId,
|
||||
@JsonProperty(required = true) String groupName,
|
||||
@JsonProperty(required = true) int revision,
|
||||
@JsonProperty(required = true) String type
|
||||
) {
|
||||
|
||||
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext, Manager m) {
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "Mention")
|
||||
@JsonSchema(title = "Mention")
|
||||
public record JsonMention(
|
||||
@Deprecated String name,
|
||||
@Schema(required = true) String number,
|
||||
@Schema(required = true) String uuid,
|
||||
@Schema(required = true) int start,
|
||||
@Schema(required = true) int length
|
||||
@JsonProperty(required = true) String number,
|
||||
@JsonProperty(required = true) String uuid,
|
||||
@JsonProperty(required = true) int start,
|
||||
@JsonProperty(required = true) int length
|
||||
) {
|
||||
|
||||
static JsonMention from(MessageEnvelope.Data.Mention mention) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
@ -11,16 +13,16 @@ import org.asamk.signal.manager.api.UntrustedIdentityException;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "MessageEnvelope")
|
||||
@JsonSchema(title = "MessageEnvelope")
|
||||
public record JsonMessageEnvelope(
|
||||
@Deprecated String source,
|
||||
@Schema(required = true) String sourceNumber,
|
||||
@Schema(required = true) String sourceUuid,
|
||||
@Schema(required = true) String sourceName,
|
||||
@Schema(required = true) Integer sourceDevice,
|
||||
@Schema(required = true) long timestamp,
|
||||
@Schema(required = true) long serverReceivedTimestamp,
|
||||
@Schema(required = true) long serverDeliveredTimestamp,
|
||||
@JsonProperty(required = true) String sourceNumber,
|
||||
@JsonProperty(required = true) String sourceUuid,
|
||||
@JsonProperty(required = true) String sourceName,
|
||||
@JsonProperty(required = true) Integer sourceDevice,
|
||||
@JsonProperty(required = true) long timestamp,
|
||||
@JsonProperty(required = true) long serverReceivedTimestamp,
|
||||
@JsonProperty(required = true) long serverDeliveredTimestamp,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonDataMessage dataMessage,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonEditMessage editMessage,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonStoryMessage storyMessage,
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/openapi/json")
|
||||
class JsonOpenApiController {
|
||||
|
||||
@GetMapping("/models")
|
||||
@Operation(summary = "Signal JSON model schema catalog")
|
||||
@ApiResponse(
|
||||
responseCode = "200", description = "Catalog of Signal JSON model schemas",
|
||||
content = @Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = JsonSchemaCatalog.class)
|
||||
)
|
||||
)
|
||||
JsonSchemaCatalog getModels() {
|
||||
return new JsonSchemaCatalog();
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,14 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "Payment")
|
||||
@JsonSchema(title = "Payment")
|
||||
public record JsonPayment(
|
||||
@Schema(required = true) String note,
|
||||
@Schema(required = true) byte[] receipt
|
||||
@JsonProperty(required = true) String note,
|
||||
@JsonProperty(required = true) byte[] receipt
|
||||
) {
|
||||
|
||||
static JsonPayment from(MessageEnvelope.Data.Payment payment) {
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "PinMessage")
|
||||
@JsonSchema(title = "PinMessage")
|
||||
public record JsonPinMessage(
|
||||
@Deprecated String targetAuthor,
|
||||
@Schema(required = true) String targetAuthorNumber,
|
||||
@Schema(required = true) String targetAuthorUuid,
|
||||
@Schema(required = true) long targetSentTimestamp,
|
||||
@Schema(required = true) long pinDurationSeconds
|
||||
@JsonProperty(required = true) String targetAuthorNumber,
|
||||
@JsonProperty(required = true) String targetAuthorUuid,
|
||||
@JsonProperty(required = true) long targetSentTimestamp,
|
||||
@JsonProperty(required = true) long pinDurationSeconds
|
||||
) {
|
||||
|
||||
static JsonPinMessage from(MessageEnvelope.Data.PinMessage pinMessage) {
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "PollCreate")
|
||||
@JsonSchema(title = "PollCreate")
|
||||
public record JsonPollCreate(
|
||||
@Schema(required = true) String question,
|
||||
@Schema(required = true) boolean allowMultiple,
|
||||
@Schema(required = true) List<String> options
|
||||
@JsonProperty(required = true) String question,
|
||||
@JsonProperty(required = true) boolean allowMultiple,
|
||||
@JsonProperty(required = true) List<String> options
|
||||
) {
|
||||
|
||||
static JsonPollCreate from(MessageEnvelope.Data.PollCreate pollCreate) {
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "PollTerminate")
|
||||
public record JsonPollTerminate(@Schema(required = true) long targetSentTimestamp) {
|
||||
@JsonSchema(title = "PollTerminate")
|
||||
public record JsonPollTerminate(@JsonProperty(required = true) long targetSentTimestamp) {
|
||||
|
||||
static JsonPollTerminate from(MessageEnvelope.Data.PollTerminate pollTerminate) {
|
||||
final var targetSentTimestamp = pollTerminate.targetSentTimestamp();
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "PollVote")
|
||||
@JsonSchema(title = "PollVote")
|
||||
public record JsonPollVote(
|
||||
@Deprecated String author,
|
||||
@Schema(required = true) String authorNumber,
|
||||
@Schema(required = true) String authorUuid,
|
||||
@Schema(required = true) long targetSentTimestamp,
|
||||
@Schema(required = true) List<Integer> optionIndexes,
|
||||
@Schema(required = true) int voteCount
|
||||
@JsonProperty(required = true) String authorNumber,
|
||||
@JsonProperty(required = true) String authorUuid,
|
||||
@JsonProperty(required = true) long targetSentTimestamp,
|
||||
@JsonProperty(required = true) List<Integer> optionIndexes,
|
||||
@JsonProperty(required = true) int voteCount
|
||||
) {
|
||||
|
||||
static JsonPollVote from(MessageEnvelope.Data.PollVote pollVote) {
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "Preview")
|
||||
@JsonSchema(title = "Preview")
|
||||
public record JsonPreview(
|
||||
@Schema(required = true) String url,
|
||||
@Schema(required = true) String title,
|
||||
@Schema(required = true) String description,
|
||||
@Schema(required = true) JsonAttachment image
|
||||
@JsonProperty(required = true) String url,
|
||||
@JsonProperty(required = true) String title,
|
||||
@JsonProperty(required = true) String description,
|
||||
@JsonProperty(required = true) JsonAttachment image
|
||||
) {
|
||||
|
||||
static JsonPreview from(MessageEnvelope.Data.Preview preview) {
|
||||
|
||||
@ -1,22 +1,23 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "Quote")
|
||||
@JsonSchema(title = "Quote")
|
||||
public record JsonQuote(
|
||||
@Schema(required = true) long id,
|
||||
@JsonProperty(required = true) long id,
|
||||
@Deprecated String author,
|
||||
@Schema(required = true) String authorNumber,
|
||||
@Schema(required = true) String authorUuid,
|
||||
@Schema(required = true) String text,
|
||||
@JsonProperty(required = true) String authorNumber,
|
||||
@JsonProperty(required = true) String authorUuid,
|
||||
@JsonProperty(required = true) String text,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
|
||||
@Schema(required = true) List<JsonQuotedAttachment> attachments,
|
||||
@JsonProperty(required = true) List<JsonQuotedAttachment> attachments,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonTextStyle> textStyles
|
||||
) {
|
||||
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "QuotedAttachment")
|
||||
@JsonSchema(title = "QuotedAttachment")
|
||||
public record JsonQuotedAttachment(
|
||||
@Schema(required = true) String contentType,
|
||||
@Schema(required = true) String filename,
|
||||
@JsonProperty(required = true) String contentType,
|
||||
@JsonProperty(required = true) String filename,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment thumbnail
|
||||
) {
|
||||
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "Reaction")
|
||||
@JsonSchema(title = "Reaction")
|
||||
public record JsonReaction(
|
||||
@Schema(required = true) String emoji,
|
||||
@JsonProperty(required = true) String emoji,
|
||||
@Deprecated String targetAuthor,
|
||||
@Schema(required = true) String targetAuthorNumber,
|
||||
@Schema(required = true) String targetAuthorUuid,
|
||||
@Schema(required = true) long targetSentTimestamp,
|
||||
@Schema(required = true) boolean isRemove
|
||||
@JsonProperty(required = true) String targetAuthorNumber,
|
||||
@JsonProperty(required = true) String targetAuthorUuid,
|
||||
@JsonProperty(required = true) long targetSentTimestamp,
|
||||
@JsonProperty(required = true) boolean isRemove
|
||||
) {
|
||||
|
||||
static JsonReaction from(MessageEnvelope.Data.Reaction reaction) {
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "ReceiptMessage")
|
||||
@JsonSchema(title = "ReceiptMessage")
|
||||
record JsonReceiptMessage(
|
||||
@Schema(required = true) long when,
|
||||
@Schema(required = true) boolean isDelivery,
|
||||
@Schema(required = true) boolean isRead,
|
||||
@Schema(required = true) boolean isViewed,
|
||||
@Schema(required = true) List<Long> timestamps
|
||||
@JsonProperty(required = true) long when,
|
||||
@JsonProperty(required = true) boolean isDelivery,
|
||||
@JsonProperty(required = true) boolean isRead,
|
||||
@JsonProperty(required = true) boolean isViewed,
|
||||
@JsonProperty(required = true) List<Long> timestamps
|
||||
) {
|
||||
|
||||
static JsonReceiptMessage from(MessageEnvelope.Receipt receiptMessage) {
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.RecipientAddress;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "RecipientAddress")
|
||||
@JsonSchema(title = "RecipientAddress")
|
||||
public record JsonRecipientAddress(
|
||||
@Schema(required = true) String uuid,
|
||||
@Schema(required = true) String number,
|
||||
@Schema(required = true) String username
|
||||
@JsonProperty(required = true) String uuid,
|
||||
@JsonProperty(required = true) String number,
|
||||
@JsonProperty(required = true) String username
|
||||
) {
|
||||
|
||||
public static JsonRecipientAddress from(RecipientAddress address) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
@Schema(name = "RemoteDelete")
|
||||
record JsonRemoteDelete(@Schema(required = true) long timestamp) {}
|
||||
@JsonSchema(title = "RemoteDelete")
|
||||
record JsonRemoteDelete(@JsonProperty(required = true) long timestamp) {}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "SchemaCatalog")
|
||||
@JsonSchema(title = "SchemaCatalog")
|
||||
public class JsonSchemaCatalog {
|
||||
|
||||
public JsonAdminDelete adminDelete;
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.GroupId;
|
||||
import org.asamk.signal.manager.api.SendMessageResult;
|
||||
|
||||
@Schema(name = "SendMessageResult")
|
||||
@JsonSchema(title = "SendMessageResult")
|
||||
public record JsonSendMessageResult(
|
||||
@Schema(required = true) JsonRecipientAddress recipientAddress,
|
||||
@JsonProperty(required = true) JsonRecipientAddress recipientAddress,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
||||
@Schema(required = true) Type type,
|
||||
@JsonProperty(required = true) Type type,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String token,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) Long retryAfterSeconds
|
||||
) {
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "SharedContact")
|
||||
@JsonSchema(title = "SharedContact")
|
||||
public record JsonSharedContact(
|
||||
@Schema(required = true) JsonContactName name,
|
||||
@JsonProperty(required = true) JsonContactName name,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonContactAvatar avatar,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactPhone> phone,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactEmail> email,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactAddress> address,
|
||||
@Schema(required = true) String organization
|
||||
@JsonProperty(required = true) String organization
|
||||
) {
|
||||
|
||||
static JsonSharedContact from(MessageEnvelope.Data.SharedContact contact) {
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.util.Hex;
|
||||
|
||||
@Schema(name = "Sticker")
|
||||
@JsonSchema(title = "Sticker")
|
||||
public record JsonSticker(
|
||||
@Schema(required = true) String packId,
|
||||
@Schema(required = true) int stickerId
|
||||
@JsonProperty(required = true) String packId,
|
||||
@JsonProperty(required = true) int stickerId
|
||||
) {
|
||||
|
||||
static JsonSticker from(MessageEnvelope.Data.Sticker sticker) {
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "StoryContext")
|
||||
@JsonSchema(title = "StoryContext")
|
||||
record JsonStoryContext(
|
||||
@Schema(required = true) String authorNumber,
|
||||
@Schema(required = true) String authorUuid,
|
||||
@Schema(required = true) long sentTimestamp
|
||||
@JsonProperty(required = true) String authorNumber,
|
||||
@JsonProperty(required = true) String authorUuid,
|
||||
@JsonProperty(required = true) long sentTimestamp
|
||||
) {
|
||||
|
||||
static JsonStoryContext from(MessageEnvelope.Data.StoryContext storyContext) {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.Color;
|
||||
import org.asamk.signal.manager.api.GroupId;
|
||||
@ -9,9 +10,9 @@ import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(name = "StoryMessage")
|
||||
@JsonSchema(title = "StoryMessage")
|
||||
record JsonStoryMessage(
|
||||
@Schema(required = true) boolean allowsReplies,
|
||||
@JsonProperty(required = true) boolean allowsReplies,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment fileAttachment,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) TextAttachment textAttachment
|
||||
@ -25,7 +26,7 @@ record JsonStoryMessage(
|
||||
}
|
||||
|
||||
public record TextAttachment(
|
||||
@Schema(required = true) String text,
|
||||
@JsonProperty(required = true) String text,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String style,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String textForegroundColor,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String textBackgroundColor,
|
||||
@ -45,11 +46,11 @@ record JsonStoryMessage(
|
||||
}
|
||||
|
||||
public record Gradient(
|
||||
@Schema(required = true) String startColor,
|
||||
@Schema(required = true) String endColor,
|
||||
@Schema(required = true) List<String> colors,
|
||||
@Schema(required = true) List<Float> positions,
|
||||
@Schema(required = true) Integer angle
|
||||
@JsonProperty(required = true) String startColor,
|
||||
@JsonProperty(required = true) String endColor,
|
||||
@JsonProperty(required = true) List<String> colors,
|
||||
@JsonProperty(required = true) List<Float> positions,
|
||||
@JsonProperty(required = true) Integer angle
|
||||
) {
|
||||
|
||||
static Gradient from(MessageEnvelope.Story.TextAttachment.Gradient gradient) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
@ -10,13 +11,13 @@ import org.asamk.signal.manager.api.RecipientAddress;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "SyncDataMessage")
|
||||
@JsonSchema(title = "SyncDataMessage")
|
||||
record JsonSyncDataMessage(
|
||||
@Deprecated String destination,
|
||||
@Schema(required = true) String destinationNumber,
|
||||
@Schema(required = true) String destinationUuid,
|
||||
@JsonProperty(required = true) String destinationNumber,
|
||||
@JsonProperty(required = true) String destinationUuid,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonEditMessage editMessage,
|
||||
@Schema(required = true) @JsonUnwrapped JsonDataMessage dataMessage
|
||||
@JsonProperty(required = true) @JsonUnwrapped JsonDataMessage dataMessage
|
||||
) {
|
||||
|
||||
static JsonSyncDataMessage from(MessageEnvelope.Sync.Sent transcriptMessage, Manager m) {
|
||||
|
||||
@ -9,7 +9,8 @@ import org.asamk.signal.manager.api.RecipientAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
|
||||
enum JsonSyncMessageType {
|
||||
CONTACTS_SYNC,
|
||||
@ -17,7 +18,7 @@ enum JsonSyncMessageType {
|
||||
REQUEST_SYNC
|
||||
}
|
||||
|
||||
@Schema(name = "SyncMessage")
|
||||
@JsonSchema(title = "SyncMessage")
|
||||
record JsonSyncMessage(
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncDataMessage sentMessage,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncStoryMessage sentStoryMessage,
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "SyncReadMessage")
|
||||
@JsonSchema(title = "SyncReadMessage")
|
||||
record JsonSyncReadMessage(
|
||||
@Deprecated String sender,
|
||||
@Schema(required = true) String senderNumber,
|
||||
@Schema(required = true) String senderUuid,
|
||||
@Schema(required = true) long timestamp
|
||||
@JsonProperty(required = true) String senderNumber,
|
||||
@JsonProperty(required = true) String senderUuid,
|
||||
@JsonProperty(required = true) long timestamp
|
||||
) {
|
||||
|
||||
static JsonSyncReadMessage from(MessageEnvelope.Sync.Read readMessage) {
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "SyncStoryMessage")
|
||||
@JsonSchema(title = "SyncStoryMessage")
|
||||
record JsonSyncStoryMessage(
|
||||
@Schema(required = true) String destinationNumber,
|
||||
@Schema(required = true) String destinationUuid,
|
||||
@Schema(required = true) @JsonUnwrapped JsonStoryMessage dataMessage
|
||||
@JsonProperty(required = true) String destinationNumber,
|
||||
@JsonProperty(required = true) String destinationUuid,
|
||||
@JsonProperty(required = true) @JsonUnwrapped JsonStoryMessage dataMessage
|
||||
) {
|
||||
|
||||
static JsonSyncStoryMessage from(MessageEnvelope.Sync.Sent transcriptMessage) {
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.TextStyle;
|
||||
|
||||
@Schema(name = "TextStyle")
|
||||
@JsonSchema(title = "TextStyle")
|
||||
public record JsonTextStyle(
|
||||
@Schema(required = true) String style,
|
||||
@Schema(required = true) int start,
|
||||
@Schema(required = true) int length
|
||||
@JsonProperty(required = true) String style,
|
||||
@JsonProperty(required = true) int start,
|
||||
@JsonProperty(required = true) int length
|
||||
) {
|
||||
|
||||
static JsonTextStyle from(TextStyle textStyle) {
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.GroupId;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
@Schema(name = "TypingMessage")
|
||||
@JsonSchema(title = "TypingMessage")
|
||||
record JsonTypingMessage(
|
||||
@Schema(required = true) String action,
|
||||
@Schema(required = true) long timestamp,
|
||||
@JsonProperty(required = true) String action,
|
||||
@JsonProperty(required = true) long timestamp,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId
|
||||
) {
|
||||
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
package org.asamk.signal.json;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micronaut.jsonschema.JsonSchema;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Schema(name = "UnpinMessage")
|
||||
@JsonSchema(title = "UnpinMessage")
|
||||
public record JsonUnpinMessage(
|
||||
@Deprecated String targetAuthor,
|
||||
@Schema(required = true) String targetAuthorNumber,
|
||||
@Schema(required = true) String targetAuthorUuid,
|
||||
@Schema(required = true) long targetSentTimestamp
|
||||
@JsonProperty(required = true) String targetAuthorNumber,
|
||||
@JsonProperty(required = true) String targetAuthorUuid,
|
||||
@JsonProperty(required = true) long targetSentTimestamp
|
||||
) {
|
||||
|
||||
static JsonUnpinMessage from(MessageEnvelope.Data.UnpinMessage unpinMessage) {
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
package org.asamk.signal.openapi;
|
||||
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = "org.asamk.signal")
|
||||
@OpenAPIDefinition(info = @Info(title = "signal-cli JSON Models", version = "v1"))
|
||||
public class OpenApiDocumentationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OpenApiDocumentationApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
GroupedOpenApi jsonModelsOpenApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("json-models")
|
||||
.packagesToScan("org.asamk.signal.json")
|
||||
.pathsToMatch("/openapi/json/models")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user