From 8d22ed0b7e1eab918a87628737a6e38a0efbf0eb Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Fri, 24 Jan 2025 18:40:43 -0500 Subject: [PATCH 01/10] Update build files. --- build.gradle | 2 +- scripts/generate.sh | 29 +---------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index ee877b7..a389f1f 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ dependencies { implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' implementation 'com.google.code.gson:gson:2.10' implementation 'io.gsonfire:gson-fire:1.9.0' - implementation 'org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1' // 1.0.2 doesn't work with okkhttp3 + implementation 'org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2' implementation 'org.apache.commons:commons-lang3:3.15.0' implementation 'javax.annotation:javax.annotation-api:1.3' implementation 'org.openapitools:jackson-databind-nullable:0.2.6' diff --git a/scripts/generate.sh b/scripts/generate.sh index b411d01..4b1c897 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -5,44 +5,17 @@ scripts_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) source "$scripts_dir/version-lib.sh" main() { - local root=(JSON.java example) - local auth=(RetryingOAuth.java) - local models=(serialization \ - Camera.java \ - AnyOfCameraCameraFit.java \ - OneOfPerspectiveCameraOrthographicCamera.java \ - OneOfCADExportConfig.java \ - AnyOfPerspectiveCameraOrthographicCameraCameraFit.java \ - AnyOfCreateSceneItemRequestData.java \ - AnyOfRelationshipDataApiError.java \ - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.java \ - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.java \ - AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.java \ - AnyOfGeometrySetDataPartRevisionDataPartRenditionData.java \ - AnyOfGeometrySetRelationshipPartRevisionRelationship.java \ - AnyOfQueryByIdQueryByCollectionQueryAll.java \ - OneOfHitResultDataSceneItemDataPartRevisionData.java \ - OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.java \ - OneOfUpdateItemToDefaultRenditionOperation.java \ - OneOfSceneViewRelationshipSceneViewStateRelationship.java \ - AnyOfFileRelationshipPartAssemblyRelationship.java ) mv "src/test" . || true - for f in "${root[@]}"; do mv "src/main/java/com/vertexvis/$f" . || true; done - for f in "${auth[@]}"; do mv "src/main/java/com/vertexvis/auth/$f" . || true; done - for f in "${models[@]}"; do mv "src/main/java/com/vertexvis/model/$f" . || true; done rm -rf api gradle src - docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.4.0 generate \ + docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.11.0 generate \ --input-spec https://platform.vertexvis.com/spec \ --generator-name java \ --config /local/config.yml \ --output /local mv ./test ./src - for f in "${root[@]}"; do mv "$f" ./src/main/java/com/vertexvis; done - for f in "${auth[@]}"; do mv "$f" ./src/main/java/com/vertexvis/auth; done - for f in "${models[@]}"; do mv "$f" ./src/main/java/com/vertexvis/model; done local version version=$(_get_version) From 2961950498002888e5e0c5d01289a99d40f69941 Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Fri, 24 Jan 2025 18:41:41 -0500 Subject: [PATCH 02/10] Updated the test files to use the auto generated files. --- .../model/AnyOfCameraCameraFitTest.java | 8 ++-- ...ViewRepByPredefinedIdOpClearRepOpTest.java | 28 ++++++------ .../AnyOfCreateSceneItemRequestDataTest.java | 7 ++- ...ationshipPartAssemblyRelationshipTest.java | 4 +- ...PartRevisionDataPartRenditionDataTest.java | 18 ++++---- ...tRenditionRelationshipTypeAdapterTest.java | 25 +++++------ ...ationshipPartRevisionRelationshipTest.java | 16 +++---- ...etadataStringTypeMetadataNullTypeTest.java | 44 +++++++++---------- ...ueryByIdQueryByCollectionQueryAllTest.java | 12 ++--- ...OfRelationshipDataApiErrorAdapterTest.java | 31 +++++++------ ...DataSceneItemDataPartRevisionDataTest.java | 12 ++--- ...rspectiveCameraOrthographicCameraTest.java | 2 +- ...ionshipSceneViewStateRelationshipTest.java | 16 +++---- 13 files changed, 110 insertions(+), 113 deletions(-) diff --git a/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java b/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java index d841c98..a860148 100644 --- a/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java @@ -13,8 +13,8 @@ public class AnyOfCameraCameraFitTest { @Test void serializesCamera() { - AnyOfCameraCameraFit c = - new AnyOfCameraCameraFit(new OneOfPerspectiveCameraOrthographicCamera( + UpdateSceneViewRequestDataAttributesCamera c = + new UpdateSceneViewRequestDataAttributesCamera(new UpdateSceneViewRequestDataAttributesCamera( new PerspectiveCamera().lookAt( new Vector3().x(new BigDecimal(2)).y(new BigDecimal(4)).z(new BigDecimal(6))) )); @@ -26,8 +26,8 @@ void serializesCamera() { @Test void serializesCameraFit() { - AnyOfCameraCameraFit c = - new AnyOfCameraCameraFit(new CameraFit().type(FIT_VISIBLE_SCENE_ITEMS)); + UpdateSceneViewRequestDataAttributesCamera c = + new UpdateSceneViewRequestDataAttributesCamera(new CameraFit().type(FIT_VISIBLE_SCENE_ITEMS)); String expected = "{\"type\":\"fit-visible-scene-items\"}"; diff --git a/src/test/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOpTest.java b/src/test/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOpTest.java index a1b94c1..b4ce84c 100644 --- a/src/test/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOpTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOpTest.java @@ -10,10 +10,10 @@ public class AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransfo @Test void serializesChangeVisibilityOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new ChangeVisibilityOp().type( ChangeVisibilityOp.TypeEnum.CHANGE_VISIBILITY).visible(false)); @@ -24,10 +24,10 @@ void serializesChangeVisibilityOperation() { @Test void serializesChangeMaterialOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new ChangeMaterialOp().type(ChangeMaterialOp.TypeEnum.CHANGE_MATERIAL) .material(new ColorMaterial())); @@ -38,10 +38,10 @@ void serializesChangeMaterialOperation() { @Test void serializesClearMaterialOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new ClearMaterialOp().type(ClearMaterialOp.TypeEnum.CLEAR_MATERIAL)); String expected = "{\"type\":\"clear-material\"}"; @@ -51,10 +51,10 @@ void serializesClearMaterialOperation() { @Test void serializesChangeTransformOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new ChangeTransformOp().type(ChangeTransformOp.TypeEnum.CHANGE_TRANSFORM) .transform(new Matrix4())); @@ -65,10 +65,10 @@ void serializesChangeTransformOperation() { @Test void serializesClearTransformOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new ClearTransformOp().type(ClearTransformOp.TypeEnum.CLEAR_TRANSFORM)); String expected = "{\"type\":\"clear-transform\"}"; @@ -78,10 +78,10 @@ void serializesClearTransformOperation() { @Test void serializesSelectOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new SelectOp().type(SelectOp.TypeEnum.SELECT)); String expected = "{\"type\":\"select\"}"; @@ -91,10 +91,10 @@ void serializesSelectOperation() { @Test void serializesDeselectOperation() { - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp + SceneOperationOperationsInner op = - new AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( + new SceneOperationOperationsInner( new DeselectOperation().type(DeselectOperation.TypeEnum.DESELECT)); String expected = "{\"type\":\"deselect\"}"; diff --git a/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java b/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java index 6e6c4f4..e37dff7 100644 --- a/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - import com.vertexvis.JSON; import org.junit.jupiter.api.Test; @@ -10,9 +9,9 @@ public class AnyOfCreateSceneItemRequestDataTest { @Test void serializesCreateSceneItemRequestData() { - AnyOfCreateSceneItemRequestData c = - new AnyOfCreateSceneItemRequestData(new CreateSceneItemRequestData().type("my-type") - .attributes(new CreateSceneItemRequestDataAttributes().name("my-name"))); + CreateSceneItemRequestData c = + new CreateSceneItemRequestData().type("my-type") + .attributes(new CreateSceneItemRequestDataAttributes().name("my-name")); String exp = "{\"type\":\"my-type\",\"attributes\":{\"name\":\"my-name\"}}"; diff --git a/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java b/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java index bbfd317..d45f84b 100644 --- a/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java @@ -26,8 +26,8 @@ private static List createPartRevisionInstances(List @Test void serializesAnyOfFileRelationshipPartAssemblyRelationships() { UUID id = UUID.randomUUID(); - AnyOfFileRelationshipPartAssemblyRelationship rel = - new AnyOfFileRelationshipPartAssemblyRelationship( + CreatePartRequestDataRelationshipsSource rel = + new CreatePartRequestDataRelationshipsSource( new PartAssemblyRelationship() .data(new PartAssemblyRelationshipData() .metadata(Collections.emptyMap()) diff --git a/src/test/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTest.java b/src/test/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTest.java index 855a8b1..bd36417 100644 --- a/src/test/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTest.java @@ -22,9 +22,9 @@ public void deserializesIncludedPartRevision() { assertEquals(1, d.getIncluded().size()); var i = d.getIncluded().get(0); - assertFalse(i.isPartRenditionData()); - assertTrue(i.isPartRevisionData()); - assertFalse(i.isGeometrySetData()); + assertFalse(i.getActualInstance() instanceof PartRenditionData); + assertTrue(i.getActualInstance() instanceof PartRevisionData); + assertFalse(i.getActualInstance() instanceof GeometrySetData); var r = i.getPartRevisionData().getRelationships(); assertNotNull(r.getGeometrySet()); assertNotNull(r.getPart()); @@ -40,9 +40,9 @@ public void deserializesIncludedPartRendition() { assertEquals(1, d.getIncluded().size()); var i = d.getIncluded().get(0); - assertTrue(i.isPartRenditionData()); - assertFalse(i.isPartRevisionData()); - assertFalse(i.isGeometrySetData()); + assertTrue(i.getActualInstance() instanceof PartRenditionData); + assertFalse(i.getActualInstance() instanceof PartRevisionData); + assertFalse(i.getActualInstance() instanceof GeometrySetData); var r = i.getPartRenditionData().getRelationships(); assertNotNull(r.getGeometrySet()); assertNotNull(r.getPartRevision()); @@ -57,9 +57,9 @@ public void deserializedIncludedGeometrySet() { assertEquals(1, d.getIncluded().size()); var i = d.getIncluded().get(0); - assertFalse(i.isPartRenditionData()); - assertFalse(i.isPartRevisionData()); - assertTrue(i.isGeometrySetData()); + assertFalse(i.getActualInstance() instanceof PartRenditionData); + assertFalse(i.getActualInstance() instanceof PartRevisionData); + assertTrue(i.getActualInstance() instanceof GeometrySetData); var r = i.getGeometrySetData(); assertEquals(UUID.fromString("df9a193c-d518-46b7-8a20-f4e204c51b3b"), r.getId()); } diff --git a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java index 2c87449..b858072 100644 --- a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - import com.google.gson.reflect.TypeToken; import com.vertexvis.JSON; @@ -16,8 +15,8 @@ public class AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationsh void serializesGeometrySetRelationships() { UUID id = UUID.randomUUID(); - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship rel = - new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( + CreateSceneItemRequestDataRelationshipsSource rel = + new CreateSceneItemRequestDataRelationshipsSource( new GeometrySetRelationship() .data(new GeometrySetRelationshipData().id(id) .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET))); @@ -47,16 +46,16 @@ void deserializeGeometrySetRelationships() { .data(new GeometrySetRelationshipData().id(id) .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET)); - assertEquals(result.getRelationships().getSource().getRel(), expected); - assertEquals(result.getRelationships().getSource().getGeometrySetRel(), expected); + assertEquals(result.getRelationships().getSource().getActualInstance(), expected); + assertEquals(result.getRelationships().getSource().getGeometrySetRelationship(), expected); } @Test void serializesPartRevisionRelationships() { UUID id = UUID.randomUUID(); - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship rel = - new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( + CreateSceneItemRequestDataRelationshipsSource rel = + new CreateSceneItemRequestDataRelationshipsSource( new PartRevisionRelationship() .data(new PartDataRelationshipsPartRevisions().id(id) .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION))); @@ -86,16 +85,16 @@ void deserializePartRevisionRelationships() { .data(new PartDataRelationshipsPartRevisions().id(id) .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION)); - assertEquals(result.getRelationships().getSource().getRel(), expected); - assertEquals(result.getRelationships().getSource().getPartRevisionRel(), expected); + assertEquals(result.getRelationships().getSource().getActualInstance(), expected); + assertEquals(result.getRelationships().getSource().getPartRevisionRelationship(), expected); } @Test void serializesSceneRelationships() { UUID id = UUID.randomUUID(); - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship rel = - new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( + CreateSceneItemRequestDataRelationshipsSource rel = + new CreateSceneItemRequestDataRelationshipsSource( new SceneRelationship() .data( new SceneRelationshipData().id(id).type(SceneRelationshipData.TypeEnum.SCENE))); @@ -122,8 +121,8 @@ void deserializeSceneRelationships() { new SceneRelationship() .data(new SceneRelationshipData().id(id).type(SceneRelationshipData.TypeEnum.SCENE)); - assertEquals(result.getRelationships().getSource().getRel(), expected); - assertEquals(result.getRelationships().getSource().getSceneRel(), expected); + assertEquals(result.getRelationships().getSource().getActualInstance(), expected); + assertEquals(result.getRelationships().getSource().getSceneRelationship(), expected); } } diff --git a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipTest.java b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipTest.java index 1402313..600451a 100644 --- a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipTest.java @@ -14,8 +14,8 @@ public class AnyOfGeometrySetRelationshipPartRevisionRelationshipTest { @Test void serializesGeometrySetRelationships() { UUID id = UUID.randomUUID(); - AnyOfGeometrySetRelationshipPartRevisionRelationship rel = - new AnyOfGeometrySetRelationshipPartRevisionRelationship( + UpdateSceneItemRequestDataRelationshipsSource rel = + new UpdateSceneItemRequestDataRelationshipsSource( new GeometrySetRelationship() .data(new GeometrySetRelationshipData().id(id) .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET))); @@ -41,16 +41,16 @@ void deserializeGeometrySetRelationships() { .data(new GeometrySetRelationshipData().id(id) .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET)); - assertEquals(result.getSource().getRel(), expected); - assertEquals(result.getSource().getGeometrySetRel(), expected); + assertEquals(result.getSource().getActualInstance(), expected); + assertEquals(result.getSource().getGeometrySetRelationship(), expected); } @Test void serializesPartRevisionRelationships() { UUID id = UUID.randomUUID(); - AnyOfGeometrySetRelationshipPartRevisionRelationship rel = - new AnyOfGeometrySetRelationshipPartRevisionRelationship( + UpdateSceneItemRequestDataRelationshipsSource rel = + new UpdateSceneItemRequestDataRelationshipsSource( new PartRevisionRelationship() .data(new PartDataRelationshipsPartRevisions().id(id) .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION))); @@ -76,7 +76,7 @@ void deserializePartRevisionRelationships() { .data(new PartDataRelationshipsPartRevisions().id(id) .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION)); - assertEquals(result.getSource().getRel(), expected); - assertEquals(result.getSource().getPartRevisionRel(), expected); + assertEquals(result.getSource().getActualInstance(), expected); + assertEquals(result.getSource().getPartRevisionRelationship(), expected); } } diff --git a/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java b/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java index 2774d6e..b80c77f 100644 --- a/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java @@ -14,7 +14,7 @@ class AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMe @Test void serializeMetadataFloatType() { var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataFloatType().type("float").value(123.456f)); String expected = "{\"type\":\"float\",\"value\":123.456}"; @@ -28,10 +28,10 @@ void deserializeMetadataFloatType() { var out = deserializeAnyOf(json); assertTrue( - out instanceof AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType); + out instanceof UpdatePartRevisionRequestDataAttributesMetadataValue); var anyOf = - (AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType) out; - assertTrue(anyOf.isMetadataFloatType()); + (UpdatePartRevisionRequestDataAttributesMetadataValue) out; + assertTrue(anyOf.getActualInstance() instanceof MetadataFloatType); assertEquals(123.456f, Objects.requireNonNull(anyOf.getMetadataFloatType()).getValue()); assertEquals("float", Objects.requireNonNull(anyOf.getMetadataFloatType()).getType()); @@ -40,7 +40,7 @@ void deserializeMetadataFloatType() { @Test void serializeMetadataLongType() { var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataLongType().type("long").value(1234567890L)); String expected = "{\"type\":\"long\",\"value\":1234567890}"; @@ -54,10 +54,10 @@ void deserializeMetadataLongType() { var out = deserializeAnyOf(json); assertTrue( - out instanceof AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType); + out instanceof UpdatePartRevisionRequestDataAttributesMetadataValue); var anyOf = - (AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType) out; - assertTrue(anyOf.isMetadataLongType()); + (UpdatePartRevisionRequestDataAttributesMetadataValue) out; + assertTrue(anyOf.getActualInstance() instanceof MetadataLongType); assertEquals(1234567890, Objects.requireNonNull(anyOf.getMetadataLongType()).getValue()); assertEquals("long", Objects.requireNonNull(anyOf.getMetadataLongType()).getType()); @@ -67,7 +67,7 @@ void deserializeMetadataLongType() { void serializeMetadataDateType() { var expectedDate = OffsetDateTime.of(2023, 1, 2, 3, 4, 5, 6, ZoneOffset.ofHours(7)); var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataDateType().type("date").value(expectedDate)); String expected = "{\"type\":\"date\",\"value\":\"2023-01-02T03:04:05.000000006+07:00\"}"; @@ -82,10 +82,10 @@ void deserializeMetadataDateType() { var out = deserializeAnyOf(json); assertTrue( - out instanceof AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType); + out instanceof UpdatePartRevisionRequestDataAttributesMetadataValue); var anyOf = - (AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType) out; - assertTrue(anyOf.isMetadataDateType()); + (UpdatePartRevisionRequestDataAttributesMetadataValue) out; + assertTrue(anyOf.getActualInstance() instanceof MetadataDateType); assertEquals(expectedDate, Objects.requireNonNull(anyOf.getMetadataDateType()).getValue()); assertEquals("date", Objects.requireNonNull(anyOf.getMetadataDateType()).getType()); @@ -94,7 +94,7 @@ void deserializeMetadataDateType() { @Test void serializeMetadataStringType() { var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataStringType().type("string").value("Hello world")); String expected = "{\"type\":\"string\",\"value\":\"Hello world\"}"; @@ -108,10 +108,10 @@ void deserializeMetadataStringType() { var out = deserializeAnyOf(json); assertTrue( - out instanceof AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType); + out instanceof UpdatePartRevisionRequestDataAttributesMetadataValue); var anyOf = - (AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType) out; - assertTrue(anyOf.isMetadataStringType()); + (UpdatePartRevisionRequestDataAttributesMetadataValue) out; + assertTrue(anyOf.getActualInstance() instanceof MetadataStringType); assertEquals("Hello world", Objects.requireNonNull(anyOf.getMetadataStringType()).getValue()); assertEquals("string", @@ -121,7 +121,7 @@ void deserializeMetadataStringType() { @Test void serializeMetadataNullType() { var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataNullType().type("null")); String expected = "{\"type\":\"null\"}"; @@ -135,10 +135,10 @@ void deserializeMetadataNullType() { var out = deserializeAnyOf(json); assertTrue( - out instanceof AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType); + out instanceof UpdatePartRevisionRequestDataAttributesMetadataValue); var anyOf = - (AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType) out; - assertTrue(anyOf.isMetadataNullType()); + (UpdatePartRevisionRequestDataAttributesMetadataValue) out; + assertTrue(anyOf.getActualInstance() instanceof MetadataNullType); } @Test @@ -154,7 +154,7 @@ void deserializeFails() { @Test void serializeUpdateSceneItemRequestDataAttributes() { var md = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( + new UpdatePartRevisionRequestDataAttributesMetadataValue( new MetadataStringType().type("string").value("Hello world")); var map = new UpdateSceneItemRequestDataAttributes().putMetadataItem("key", md); String observed = new JSON().serialize(map); @@ -165,6 +165,6 @@ void serializeUpdateSceneItemRequestDataAttributes() { private static Object deserializeAnyOf(String json) { return new JSON().deserialize(json, - AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.class); + UpdatePartRevisionRequestDataAttributesMetadataValue.class); } } \ No newline at end of file diff --git a/src/test/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAllTest.java b/src/test/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAllTest.java index d501916..70eaf59 100644 --- a/src/test/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAllTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAllTest.java @@ -15,8 +15,8 @@ public class AnyOfQueryByIdQueryByCollectionQueryAllTest { void serializesQueryById() { UUID id = UUID.randomUUID(); - AnyOfQueryByIdQueryByCollectionQueryAll q = - new AnyOfQueryByIdQueryByCollectionQueryAll(new QueryById().data( + SceneOperationQuery q = + new SceneOperationQuery(new QueryById().data( new QueryByIdData().type(QueryByIdData.TypeEnum.QUERY_BY_ID).attributes( new QueryByIdDataAttributes().type(QueryByIdDataAttributes.TypeEnum.ID) .value(id.toString())))); @@ -33,8 +33,8 @@ void serializesQueryById() { void serializesQueryByCollection() { UUID id = UUID.randomUUID(); - AnyOfQueryByIdQueryByCollectionQueryAll q = - new AnyOfQueryByIdQueryByCollectionQueryAll( + SceneOperationQuery q = + new SceneOperationQuery( new QueryByCollection() .data(new QueryByCollectionData() .type(QueryByCollectionData.TypeEnum.QUERY_BY_COLLECTION) @@ -57,8 +57,8 @@ void serializesQueryByCollection() { @Test void serializesQueryByAll() { - AnyOfQueryByIdQueryByCollectionQueryAll q = - new AnyOfQueryByIdQueryByCollectionQueryAll(QueryAll.ALL); + SceneOperationQuery q = + new SceneOperationQuery(QueryAll.ALL); SceneOperation op = new SceneOperation().query(q); String expected = "{\"query\":\"all\",\"operations\":[]}"; diff --git a/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java b/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java index 6245576..52beb5d 100644 --- a/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java @@ -17,9 +17,9 @@ public class AnyOfRelationshipDataApiErrorAdapterTest { @Test void serializesRelationshipData() { UUID id = UUID.randomUUID(); - List list = new ArrayList<>(); - list.add(new AnyOfRelationshipDataApiError(new RelationshipData().id(id).type("my-type"))); - Batch batch = new Batch().vertexvisBatchColonResults(list); + List list = new ArrayList<>(); + list.add(new BatchVertexvisBatchResultsInner(new RelationshipData().id(id).type("my-type"))); + Batch batch = new Batch().vertexvisBatchResults(list); String exp = "{\"vertexvis/batch:results\":[{\"id\":\"" + id + "\",\"type\":\"my-type\"}]}"; @@ -32,19 +32,19 @@ void deserializeRelationshipData() { String in = "{\"vertexvis/batch:results\":[{\"id\":\"" + id + "\",\"type\":\"my-type\"}]}"; Batch act = new JSON().deserialize(in, TypeToken.get(Batch.class).getType()); - AnyOfRelationshipDataApiError exp = - new AnyOfRelationshipDataApiError(new RelationshipData().id(id).type("my-type")); + BatchVertexvisBatchResultsInner exp = + new BatchVertexvisBatchResultsInner(new RelationshipData().id(id).type("my-type")); - assertEquals(exp.getObj(), act.getVertexvisBatchColonResults().get(0).getObj()); + assertEquals(exp.getActualInstance(), act.getVertexvisBatchResults().get(0).getActualInstance()); } @Test void serializesApiError() { UUID id = UUID.randomUUID(); - List list = new ArrayList<>(); - list.add(new AnyOfRelationshipDataApiError( + List list = new ArrayList<>(); + list.add(new BatchVertexvisBatchResultsInner( new ApiError().id(id.toString()).status("my-status").code("500"))); - Batch batch = new Batch().vertexvisBatchColonResults(list); + Batch batch = new Batch().vertexvisBatchResults(list); String exp = "{\"vertexvis/batch:results\":[{\"id\":\"" + id + "\",\"status\":\"my-status\",\"code\":\"500\"}]}"; @@ -59,11 +59,11 @@ void deserializeApiError() { "\",\"status\":\"my-status\",\"code\":\"500\"}]}"; Batch act = new JSON().deserialize(in, TypeToken.get(Batch.class).getType()); - AnyOfRelationshipDataApiError exp = - new AnyOfRelationshipDataApiError( + BatchVertexvisBatchResultsInner exp = + new BatchVertexvisBatchResultsInner( new ApiError().id(id.toString()).status("my-status").code("500")); - assertEquals(exp.getObj(), act.getVertexvisBatchColonResults().get(0).getObj()); + assertEquals(exp.getActualInstance(), act.getVertexvisBatchResults().get(0).getActualInstance()); } @Test @@ -73,11 +73,10 @@ void deserializeApiErrorWithSource() { "\",\"status\":\"my-status\",\"code\":\"500\",\"source\":{\"pointer\":\"/data/id\"}}]}"; Batch act = new JSON().deserialize(in, TypeToken.get(Batch.class).getType()); - AnyOfRelationshipDataApiError exp = - new AnyOfRelationshipDataApiError( + BatchVertexvisBatchResultsInner exp = + new BatchVertexvisBatchResultsInner( new ApiError().id(id.toString()).status("my-status").code("500") .source(new ApiErrorSource().pointer("/data/id"))); - assertEquals(exp.getObj(), act.getVertexvisBatchColonResults().get(0).getObj()); - } + assertEquals(exp.getActualInstance(), act.getVertexvisBatchResults().get(0).getActualInstance()); } } diff --git a/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java b/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java index de52ea8..2995c5c 100644 --- a/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java +++ b/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java @@ -14,8 +14,8 @@ public class OneOfHitResultDataSceneItemDataPartRevisionDataTest { @Test void serializesHitResultData() { UUID id = UUID.randomUUID(); - OneOfHitResultDataSceneItemDataPartRevisionData d = - new OneOfHitResultDataSceneItemDataPartRevisionData( + HitIncludedInner d = + new HitIncludedInner( new HitResultData().type("some-type").id(id)); String expected = "{\"type\":\"some-type\",\"id\":\"" + id + "\"}"; @@ -26,8 +26,8 @@ void serializesHitResultData() { @Test void serializesSceneItemData() { UUID id = UUID.randomUUID(); - OneOfHitResultDataSceneItemDataPartRevisionData d = - new OneOfHitResultDataSceneItemDataPartRevisionData( + HitIncludedInner d = + new HitIncludedInner( new SceneItemData().id(id).type("scene-item")); String expected = "{\"type\":\"scene-item\",\"id\":\"" + id + "\"}"; @@ -38,8 +38,8 @@ void serializesSceneItemData() { @Test void serializesPartRevisionData() { UUID id = UUID.randomUUID(); - OneOfHitResultDataSceneItemDataPartRevisionData d = - new OneOfHitResultDataSceneItemDataPartRevisionData( + HitIncludedInner d = + new HitIncludedInner( new PartRevisionData().id(id).type("part-revision")); String expected = "{\"type\":\"part-revision\",\"id\":\"" + id + "\"}"; diff --git a/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java b/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java index 0821db2..6301339 100644 --- a/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java +++ b/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java @@ -53,7 +53,7 @@ void serializePerspectiveCamera() { ); perspectiveCamera.setType("perspective"); - OneOfPerspectiveCameraOrthographicCamera oneOfPerspectiveCameraOrthographicCamera = new OneOfPerspectiveCameraOrthographicCamera(perspectiveCamera); + CreateSceneViewRequestDataAttributesCamera oneOfPerspectiveCameraOrthographicCamera = new CreateSceneViewRequestDataAttributesCamera(perspectiveCamera); String expected = "{\"camera\":{\"type\":\"perspective\",\"position\":{\"x\":3,\"y\":3,\"z\":3},\"lookAt\":{\"x\":1,\"y\":1,\"z\":1},\"up\":{\"x\":2,\"y\":2,\"z\":2}}}"; diff --git a/src/test/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationshipTest.java b/src/test/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationshipTest.java index 0450d22..a2ae392 100644 --- a/src/test/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationshipTest.java +++ b/src/test/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationshipTest.java @@ -14,8 +14,8 @@ public class OneOfSceneViewRelationshipSceneViewStateRelationshipTest { @Test void serializesSceneViewRelationship() { UUID id = UUID.randomUUID(); - OneOfSceneViewRelationshipSceneViewStateRelationship rel = - new OneOfSceneViewRelationshipSceneViewStateRelationship(new SceneViewRelationship() + CreateSceneViewStateRequestDataRelationshipsSource rel = + new CreateSceneViewStateRequestDataRelationshipsSource(new SceneViewRelationship() .data( new SceneViewRelationshipData().type(SceneViewRelationshipData.TypeEnum.SCENE_VIEW) .id(id))); @@ -41,15 +41,15 @@ void deserializeSceneViewRelationship() { .data(new SceneViewRelationshipData().id(id) .type(SceneViewRelationshipData.TypeEnum.SCENE_VIEW)); - assertEquals(result.getSource().getRel(), expected); - assertEquals(result.getSource().getSceneViewRel(), expected); + assertEquals(result.getSource().getActualInstance(), expected); + assertEquals(result.getSource().getSceneViewRelationship(), expected); } @Test void serializesSceneViewStateRelationship() { UUID id = UUID.randomUUID(); - OneOfSceneViewRelationshipSceneViewStateRelationship rel = - new OneOfSceneViewRelationshipSceneViewStateRelationship( + CreateSceneViewStateRequestDataRelationshipsSource rel = + new CreateSceneViewStateRequestDataRelationshipsSource( new SceneViewStateRelationship() .data( new SceneViewStateRelationshipData() @@ -78,7 +78,7 @@ void deserializeSceneViewStateRelationship() { .data(new SceneViewStateRelationshipData().id(id) .type(SceneViewStateRelationshipData.TypeEnum.SCENE_VIEW_STATE)); - assertEquals(result.getSource().getRel(), expected); - assertEquals(result.getSource().getSceneViewStateRel(), expected); + assertEquals(result.getSource().getActualInstance(), expected); + assertEquals(result.getSource().getSceneViewStateRelationship(), expected); } } From 425f49d652a734be42e58ea0cf03fb46bf0754fa Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Sun, 26 Jan 2025 13:00:50 -0500 Subject: [PATCH 03/10] SOme unit test updates --- .../model/AnyOfCreateSceneItemRequestDataTest.java | 2 +- ...fFileRelationshipPartAssemblyRelationshipTest.java | 11 +++++------ ...nshipPartRenditionRelationshipTypeAdapterTest.java | 11 +++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java b/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java index e37dff7..8964698 100644 --- a/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfCreateSceneItemRequestDataTest.java @@ -13,7 +13,7 @@ void serializesCreateSceneItemRequestData() { new CreateSceneItemRequestData().type("my-type") .attributes(new CreateSceneItemRequestDataAttributes().name("my-name")); - String exp = "{\"type\":\"my-type\",\"attributes\":{\"name\":\"my-name\"}}"; + String exp = "{\"type\":\"my-type\",\"attributes\":{\"name\":\"my-name\",\"metadata\":{},\"experimentalSourceMetadataKeys\":[]}}"; assertEquals(exp, new JSON().serialize(c)); } diff --git a/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java b/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java index d45f84b..3ff4aad 100644 --- a/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationshipTest.java @@ -18,8 +18,7 @@ private static List createPartRevisionInstances(List return IntStream.range(0, num) .mapToObj(ordinal -> new PartRevisionInstance(). ordinal(ordinal) - .revisionId(ids.get(ordinal)) - .transform(new Matrix4())) + .revisionId(ids.get(ordinal))) .collect(Collectors.toList()); } @@ -40,8 +39,8 @@ void serializesAnyOfFileRelationshipPartAssemblyRelationships() { .attributes(new CreatePartRequestDataAttributes().name("test").suppliedId("testid").suppliedRevisionId("testRevisionId").metadata(Collections.emptyMap())) .relationships(reqData)); - String expectedData = "{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\",\"transform\":{}}],\"metadata\":{}}}}"; - String expectedRequest = "{\"data\":{\"type\":\"assembly\",\"attributes\":{\"suppliedId\":\"testid\",\"suppliedRevisionId\":\"testRevisionId\",\"metadata\":{},\"name\":\"test\"},\"relationships\":{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\",\"transform\":{}}],\"metadata\":{}}}}}}"; + String expectedData = "{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\"}],\"metadata\":{}}}}"; + String expectedRequest = "{\"data\":{\"type\":\"assembly\",\"attributes\":{\"suppliedId\":\"testid\",\"suppliedRevisionId\":\"testRevisionId\",\"metadata\":{},\"name\":\"test\"},\"relationships\":{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\"}],\"metadata\":{}}}}}}"; assertEquals(expectedData, new JSON().serialize(reqData)); assertEquals(expectedRequest, new JSON().serialize(request)); @@ -51,9 +50,9 @@ void serializesAnyOfFileRelationshipPartAssemblyRelationships() { void deserializeAnyOfFileRelationshipPartAssemblyRelationships() { UUID id = UUID.randomUUID(); - String relationshipsPayload = "{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\",\"transform\":{}}],\"metadata\":[]}}}"; + String relationshipsPayload = "{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\"}],\"metadata\":{}}}}"; String requestWithAssemblyRelationshipPayload = //"{\"data\":{\"type\":\"assembly\",\"attributes\":{\"suppliedId\":\"my-assembly-9cc7f76a-c719-4985-a460-04e2ec085a55\",\"suppliedRevisionId\":\"my-part-rev-9cc7f76a-c719-4985-a460-04e2ec085a55\",\"name\":\"gbiv-assemblyee3e3aef-caa1-4739-aada-d11ac0392e38\"},\"relationships\":{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"4b2bb5e2-c8fe-4307-9f09-638dbbbf4bb7\",\"transform\":{}},{\"ordinal\":1,\"revisionId\":\"d927b4e5-54a0-4fed-8867-36811cc822c0\",\"transform\":{}},{\"ordinal\":2,\"revisionId\":\"54714ba5-6ac7-4b0b-968a-daa5e63e986f\",\"transform\":{}}],\"metadata\":{}}}}}}"; - "{\"data\":{\"type\":\"assembly\",\"attributes\":{\"suppliedId\":\"testid\",\"suppliedRevisionId\":\"testRevisionId\",\"metadata\":{},\"name\":\"test\"},\"relationships\":{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\",\"transform\":{}}],\"metadata\":{}}}}}}"; + "{\"data\":{\"type\":\"assembly\",\"attributes\":{\"suppliedId\":\"testid\",\"suppliedRevisionId\":\"testRevisionId\",\"metadata\":{},\"name\":\"test\"},\"relationships\":{\"source\":{\"data\":{\"children\":[{\"ordinal\":0,\"revisionId\":\"" + id + "\"}],\"metadata\":{}}}}}}"; CreatePartRequestDataRelationships requestDataRelationships = new JSON() .deserialize(relationshipsPayload, TypeToken.get(CreatePartRequestDataRelationships.class).getType()); diff --git a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java index b858072..87c6179 100644 --- a/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationshipTypeAdapterTest.java @@ -36,7 +36,8 @@ void deserializeGeometrySetRelationships() { UUID id = UUID.randomUUID(); String input = - "{\"relationships\":{\"source\":{\"data\":{\"type\":\"geometry-set\",\"id\":\"" + id + + "{\"attributes\":{},\"type\":\"scene-item\"," + + "\"relationships\":{\"source\":{\"data\":{\"type\":\"geometry-set\",\"id\":\"" + id + "\"}}}}"; CreateSceneItemRequestData result = @@ -75,8 +76,9 @@ void deserializePartRevisionRelationships() { UUID id = UUID.randomUUID(); String input = - "{\"relationships\":{\"source\":{\"data\":{\"type\":\"part-revision\",\"id\":\"" + id + - "\"}}}}"; + "{\"attributes\":{\"metadata\":{},\"experimentalSourceMetadataKeys\":[]},\"type\":\"scene-item\"," + + "\"relationships\":{\"source\":{\"data\":{\"type\":\"part-revision\",\"id\":\"" + id + + "\"}}}}"; CreateSceneItemRequestData result = new JSON().deserialize(input, TypeToken.get(CreateSceneItemRequestData.class).getType()); @@ -113,7 +115,8 @@ void deserializeSceneRelationships() { UUID id = UUID.randomUUID(); String input = - "{\"relationships\":{\"source\":{\"data\":{\"type\":\"scene\",\"id\":\"" + id + "\"}}}}"; + "{\"attributes\":{},\"type\":\"scene-item\"," + + "\"relationships\":{\"source\":{\"data\":{\"type\":\"scene\",\"id\":\"" + id + "\"}}}}"; CreateSceneItemRequestData result = new JSON().deserialize(input, TypeToken.get(CreateSceneItemRequestData.class).getType()); From 841ac89ff26c10e12ec188adce30f3342887c96f Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Mon, 27 Jan 2025 14:51:36 -0500 Subject: [PATCH 04/10] Updated the generate script to use V7.11.0 of openapi generator. Also now using all but 5 generated source files. --- scripts/generate.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/generate.sh b/scripts/generate.sh index 4b1c897..37b74a1 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -5,7 +5,13 @@ scripts_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) source "$scripts_dir/version-lib.sh" main() { + local models=(MetadataDateType.java \ + MetadataFloatType.java \ + MetadataLongType.java \ + MetadataNullType.java \ + MetadataStringType.java ) mv "src/test" . || true + for f in "${models[@]}"; do mv "src/main/java/com/vertexvis/model/$f" . || true; done rm -rf api gradle src @@ -16,6 +22,7 @@ main() { --output /local mv ./test ./src + for f in "${models[@]}"; do mv "$f" ./src/main/java/com/vertexvis/model; done local version version=$(_get_version) From e3ff26cc2a603120d0b3172e67a2868e2362454c Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Mon, 27 Jan 2025 14:59:56 -0500 Subject: [PATCH 05/10] Updated / added autogenerated files. --- .openapi-generator/FILES | 76 + .openapi-generator/VERSION | 2 +- api/openapi.yaml | 3784 +++++++++++++---- gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 189 +- gradlew.bat | 37 +- src/main/java/com/vertexvis/ApiClient.java | 250 +- src/main/java/com/vertexvis/ApiException.java | 19 +- .../java/com/vertexvis/Configuration.java | 4 +- src/main/java/com/vertexvis/JSON.java | 628 ++- src/main/java/com/vertexvis/Pair.java | 2 +- .../com/vertexvis/ServerConfiguration.java | 18 +- .../java/com/vertexvis/ServerVariable.java | 14 + src/main/java/com/vertexvis/StringUtil.java | 2 +- .../java/com/vertexvis/api/AccountsApi.java | 104 +- .../com/vertexvis/api/ApplicationsApi.java | 101 +- .../java/com/vertexvis/api/BatchesApi.java | 60 +- .../java/com/vertexvis/api/ExportsApi.java | 60 +- src/main/java/com/vertexvis/api/FilesApi.java | 255 +- .../com/vertexvis/api/GeometrySetsApi.java | 58 +- src/main/java/com/vertexvis/api/HitsApi.java | 44 +- .../java/com/vertexvis/api/ModelViewsApi.java | 543 +++ .../java/com/vertexvis/api/Oauth2Api.java | 75 +- .../com/vertexvis/api/PartRenditionsApi.java | 62 +- .../api/PartRevisionInstancesApi.java | 234 + .../com/vertexvis/api/PartRevisionsApi.java | 131 +- src/main/java/com/vertexvis/api/PartsApi.java | 100 +- src/main/java/com/vertexvis/api/PmiApi.java | 230 + .../com/vertexvis/api/PropertyEntriesApi.java | 370 ++ .../vertexvis/api/SceneAlterationsApi.java | 85 +- .../vertexvis/api/SceneAnnotationsApi.java | 811 ++++ .../vertexvis/api/SceneItemOverridesApi.java | 86 +- .../java/com/vertexvis/api/SceneItemsApi.java | 149 +- .../api/SceneSynchronizationsApi.java | 85 +- .../com/vertexvis/api/SceneViewStatesApi.java | 107 +- .../java/com/vertexvis/api/SceneViewsApi.java | 157 +- .../java/com/vertexvis/api/ScenesApi.java | 187 +- .../java/com/vertexvis/api/StreamKeysApi.java | 62 +- .../api/TranslationInspectionsApi.java | 152 +- .../api/WebhookSubscriptionsApi.java | 101 +- .../java/com/vertexvis/auth/ApiKeyAuth.java | 2 +- .../com/vertexvis/auth/HttpBasicAuth.java | 2 - .../com/vertexvis/auth/HttpBearerAuth.java | 22 +- src/main/java/com/vertexvis/auth/OAuth.java | 2 +- .../java/com/vertexvis/auth/OAuthFlow.java | 13 +- .../com/vertexvis/auth/OAuthOkHttpClient.java | 16 +- .../com/vertexvis/auth/RetryingOAuth.java | 319 +- .../com/vertexvis/example/CallbackUtil.java | 40 - .../CreateAssemblyFromRevisionsExample.java | 127 - ...reatePartRevisionsWithMetadataExample.java | 127 - .../example/CreatePartsAsyncExample.java | 78 - .../vertexvis/example/CreateSceneExample.java | 81 - .../java/com/vertexvis/example/JobPoller.java | 54 - .../com/vertexvis/example/MetadataUtil.java | 55 - .../com/vertexvis/example/PartCreator.java | 130 - .../com/vertexvis/example/SceneCreator.java | 85 - .../example/cmdline/CommandLineOptions.java | 68 - .../model/AbstractOpenApiSchema.java | 146 + .../java/com/vertexvis/model/Account.java | 154 +- .../java/com/vertexvis/model/AccountData.java | 175 +- .../model/AccountDataAttributes.java | 172 +- .../model/AdminConsentAcceptRequest.java | 139 +- .../model/AdminConsentAcceptRequestData.java | 157 +- ...minConsentAcceptRequestDataAttributes.java | 137 +- .../model/AdminCreateApplicationRequest.java | 139 +- .../AdminCreateApplicationRequestData.java | 157 +- ...reateApplicationRequestDataAttributes.java | 180 +- .../model/AdminLoginAcceptRequest.java | 139 +- .../model/AdminLoginAcceptRequestData.java | 157 +- ...AdminLoginAcceptRequestDataAttributes.java | 140 +- .../com/vertexvis/model/AdminRedirectTo.java | 140 +- .../vertexvis/model/AnyOfCameraCameraFit.java | 37 - ...IdOpViewRepByPredefinedIdOpClearRepOp.java | 109 - .../AnyOfCreateSceneItemRequestData.java | 20 - ...eRelationshipPartAssemblyRelationship.java | 38 - ...DataPartRevisionDataPartRenditionData.java | 48 - ...tRelationshipPartRevisionRelationship.java | 41 - ...RelationshipPartRenditionRelationship.java | 73 - ...ypeMetadataStringTypeMetadataNullType.java | 84 - ...tiveCameraOrthographicCameraCameraFit.java | 52 - ...yOfQueryByIdQueryByCollectionQueryAll.java | 50 - .../model/AnyOfRelationshipDataApiError.java | 37 - .../java/com/vertexvis/model/ApiError.java | 249 +- .../com/vertexvis/model/ApiErrorSource.java | 149 +- .../java/com/vertexvis/model/Application.java | 154 +- .../com/vertexvis/model/ApplicationData.java | 192 +- .../model/ApplicationDataAttributes.java | 221 +- .../com/vertexvis/model/ApplicationList.java | 168 +- src/main/java/com/vertexvis/model/Batch.java | 178 +- .../com/vertexvis/model/BatchOperation.java | 190 +- .../vertexvis/model/BatchOperationRef.java | 166 +- .../BatchVertexvisBatchResultsInner.java | 271 ++ .../java/com/vertexvis/model/BoundingBox.java | 157 +- .../com/vertexvis/model/CADExportConfig.java | 124 +- src/main/java/com/vertexvis/model/Camera.java | 27 - .../java/com/vertexvis/model/CameraFit.java | 148 +- .../com/vertexvis/model/ChangeMaterialOp.java | 164 +- .../vertexvis/model/ChangeTransformOp.java | 164 +- .../vertexvis/model/ChangeVisibilityOp.java | 162 +- .../com/vertexvis/model/ClearMaterialOp.java | 147 +- .../java/com/vertexvis/model/ClearRenOp.java | 147 +- .../java/com/vertexvis/model/ClearRepOp.java | 147 +- .../com/vertexvis/model/ClearTransformOp.java | 147 +- src/main/java/com/vertexvis/model/Color3.java | 168 +- .../com/vertexvis/model/ColorMaterial.java | 221 +- .../model/ColorMaterialNullable.java | 221 +- .../vertexvis/model/CreateAccountRequest.java | 139 +- .../model/CreateAccountRequestData.java | 157 +- .../CreateAccountRequestDataAttributes.java | 140 +- .../model/CreateApplicationRequest.java | 139 +- .../vertexvis/model/CreateBatchRequest.java | 176 +- .../vertexvis/model/CreateExportRequest.java | 139 +- .../model/CreateExportRequestData.java | 174 +- .../CreateExportRequestDataAttributes.java | 166 +- ...eateExportRequestDataAttributesConfig.java | 230 + .../CreateExportRequestDataRelationships.java | 157 +- .../vertexvis/model/CreateFileRequest.java | 139 +- .../model/CreateFileRequestData.java | 157 +- .../CreateFileRequestDataAttributes.java | 206 +- .../model/CreateGeometrySetRequest.java | 139 +- .../model/CreateGeometrySetRequestData.java | 157 +- ...teGeometrySetRequestDataRelationships.java | 139 +- .../com/vertexvis/model/CreateHitRequest.java | 139 +- .../vertexvis/model/CreateHitRequestData.java | 157 +- .../model/CreateHitRequestDataAttributes.java | 156 +- .../model/CreatePartRenditionRequest.java | 139 +- .../model/CreatePartRenditionRequestData.java | 176 +- ...atePartRenditionRequestDataAttributes.java | 163 +- .../vertexvis/model/CreatePartRequest.java | 139 +- .../model/CreatePartRequestData.java | 175 +- .../CreatePartRequestDataAttributes.java | 301 +- .../CreatePartRequestDataRelationships.java | 146 +- ...atePartRequestDataRelationshipsSource.java | 268 ++ .../model/CreateSceneAlterationRequest.java | 139 +- .../CreateSceneAlterationRequestData.java | 157 +- ...eSceneAlterationRequestDataAttributes.java | 150 +- .../model/CreateSceneAnnotationRequest.java | 214 + .../CreateSceneAnnotationRequestData.java | 245 ++ ...eSceneAnnotationRequestDataAttributes.java | 244 ++ ...neAnnotationRequestDataAttributesData.java | 276 ++ .../CreateSceneAnnotationSetRequest.java | 214 + .../CreateSceneAnnotationSetRequestData.java | 245 ++ ...eneAnnotationSetRequestDataAttributes.java | 236 + .../model/CreateSceneItemOverrideRequest.java | 139 +- .../CreateSceneItemOverrideRequestData.java | 174 +- ...ceneItemOverrideRequestDataAttributes.java | 207 +- ...eItemOverrideRequestDataRelationships.java | 139 +- .../model/CreateSceneItemRequest.java | 139 +- .../model/CreateSceneItemRequestData.java | 174 +- .../CreateSceneItemRequestDataAttributes.java | 356 +- ...eateSceneItemRequestDataRelationships.java | 188 +- ...eneItemRequestDataRelationshipsSource.java | 360 ++ .../vertexvis/model/CreateSceneRequest.java | 139 +- .../model/CreateSceneRequestData.java | 175 +- .../CreateSceneRequestDataAttributes.java | 235 +- .../CreateSceneRequestDataRelationships.java | 139 +- .../model/CreateSceneSyncRequest.java | 172 +- .../CreateSceneSyncRequestOperation.java | 231 + .../model/CreateSceneViewRequest.java | 139 +- .../model/CreateSceneViewRequestData.java | 175 +- .../CreateSceneViewRequestDataAttributes.java | 172 +- ...eSceneViewRequestDataAttributesCamera.java | 277 ++ ...eateSceneViewRequestDataRelationships.java | 133 +- .../model/CreateSceneViewStateRequest.java | 139 +- .../CreateSceneViewStateRequestData.java | 174 +- ...teSceneViewStateRequestDataAttributes.java | 149 +- ...ceneViewStateRequestDataRelationships.java | 148 +- ...ewStateRequestDataRelationshipsSource.java | 276 ++ .../model/CreateStreamKeyRequest.java | 139 +- .../model/CreateStreamKeyRequestData.java | 157 +- .../CreateStreamKeyRequestDataAttributes.java | 143 +- .../CreateTranslationInspectionRequest.java | 139 +- ...reateTranslationInspectionRequestData.java | 157 +- .../CreateWebhookSubscriptionRequest.java | 139 +- .../CreateWebhookSubscriptionRequestData.java | 157 +- ...hookSubscriptionRequestDataAttributes.java | 164 +- .../vertexvis/model/CreatedApplication.java | 139 +- .../model/CreatedApplicationData.java | 175 +- .../CreatedApplicationDataAttributes.java | 239 +- .../com/vertexvis/model/CrossSectioning.java | 150 +- .../vertexvis/model/DeselectOperation.java | 147 +- .../java/com/vertexvis/model/Dimensions.java | 153 +- src/main/java/com/vertexvis/model/Export.java | 154 +- .../com/vertexvis/model/ExportConfig.java | 104 +- .../java/com/vertexvis/model/ExportData.java | 192 +- .../vertexvis/model/ExportDataAttributes.java | 155 +- .../vertexvis/model/ExportRelationship.java | 140 +- .../model/ExportRelationshipData.java | 165 +- .../model/ExportStateRelationship.java | 140 +- .../model/ExportStateRelationshipData.java | 165 +- .../java/com/vertexvis/model/Failure.java | 181 +- .../com/vertexvis/model/FeatureLines.java | 154 +- .../java/com/vertexvis/model/FileList.java | 168 +- .../com/vertexvis/model/FileMetadata.java | 154 +- .../com/vertexvis/model/FileMetadataData.java | 192 +- .../model/FileMetadataDataAttributes.java | 235 +- .../com/vertexvis/model/FileRelationship.java | 140 +- .../vertexvis/model/FileRelationshipData.java | 165 +- .../com/vertexvis/model/FilterExpression.java | 356 ++ .../java/com/vertexvis/model/GeometrySet.java | 154 +- .../com/vertexvis/model/GeometrySetData.java | 192 +- .../com/vertexvis/model/GeometrySetList.java | 168 +- .../model/GeometrySetRelationship.java | 140 +- .../model/GeometrySetRelationshipData.java | 165 +- src/main/java/com/vertexvis/model/Hit.java | 194 +- .../java/com/vertexvis/model/HitData.java | 192 +- .../vertexvis/model/HitDataAttributes.java | 137 +- .../vertexvis/model/HitDataRelationships.java | 150 +- .../com/vertexvis/model/HitIncludedInner.java | 326 ++ .../com/vertexvis/model/HitResultData.java | 192 +- .../model/HitResultDataAttributes.java | 156 +- .../model/HitResultDataRelationships.java | 139 +- src/main/java/com/vertexvis/model/Link.java | 140 +- .../com/vertexvis/model/MaterialOverride.java | 134 +- .../java/com/vertexvis/model/Matrix4.java | 191 +- .../com/vertexvis/model/Matrix4Nullable.java | 191 +- .../com/vertexvis/model/MetadataDateType.java | 156 +- .../vertexvis/model/MetadataFloatType.java | 156 +- .../com/vertexvis/model/MetadataLongType.java | 159 +- .../com/vertexvis/model/MetadataNullType.java | 141 +- .../vertexvis/model/MetadataStringType.java | 159 +- .../java/com/vertexvis/model/ModelView.java | 252 ++ .../com/vertexvis/model/ModelViewData.java | 346 ++ .../model/ModelViewDataRelationships.java | 214 + .../com/vertexvis/model/ModelViewList.java | 271 ++ .../com/vertexvis/model/OAuth2BadRequest.java | 140 +- .../java/com/vertexvis/model/OAuth2Token.java | 232 +- .../vertexvis/model/OneOfCADExportConfig.java | 22 - ...sultDataSceneItemDataPartRevisionData.java | 50 - ...OfPerspectiveCameraOrthographicCamera.java | 38 - ...elationshipSceneViewStateRelationship.java | 45 - ...UpdateItemToDefaultRenditionOperation.java | 24 - ...aWebhookEventPartRevisionIncludedData.java | 37 - .../java/com/vertexvis/model/Orientation.java | 157 +- .../vertexvis/model/OrthographicCamera.java | 206 +- src/main/java/com/vertexvis/model/Part.java | 185 +- .../model/PartAssemblyRelationship.java | 140 +- .../model/PartAssemblyRelationshipData.java | 172 +- .../java/com/vertexvis/model/PartData.java | 210 +- .../vertexvis/model/PartDataAttributes.java | 173 +- .../model/PartDataRelationships.java | 150 +- .../PartDataRelationshipsPartRevisions.java | 165 +- .../model/PartInstanceRelationship.java | 214 + .../model/PartInstanceRelationshipData.java | 298 ++ .../java/com/vertexvis/model/PartList.java | 168 +- .../vertexvis/model/PartRelationshipData.java | 165 +- .../com/vertexvis/model/PartRendition.java | 154 +- .../vertexvis/model/PartRenditionData.java | 209 +- .../model/PartRenditionDataAttributes.java | 163 +- .../model/PartRenditionDataRelationships.java | 151 +- .../vertexvis/model/PartRenditionList.java | 168 +- .../model/PartRenditionRelationship.java | 140 +- .../model/PartRenditionRelationshipData.java | 165 +- .../com/vertexvis/model/PartRevision.java | 154 +- .../com/vertexvis/model/PartRevisionData.java | 209 +- .../model/PartRevisionDataAttributes.java | 216 +- .../model/PartRevisionDataRelationships.java | 169 +- .../vertexvis/model/PartRevisionInstance.java | 190 +- .../model/PartRevisionInstanceData.java | 308 ++ .../PartRevisionInstanceDataAttributes.java | 236 + ...PartRevisionInstanceDataRelationships.java | 214 + .../model/PartRevisionInstanceList.java | 271 ++ .../com/vertexvis/model/PartRevisionList.java | 168 +- .../model/PartRevisionRelationship.java | 140 +- .../model/PartRevisionSuppliedId.java | 192 +- .../vertexvis/model/PerspectiveCamera.java | 205 +- .../vertexvis/model/PmiAnnotationData.java | 315 ++ .../vertexvis/model/PmiAnnotationList.java | 271 ++ src/main/java/com/vertexvis/model/Point.java | 153 +- .../com/vertexvis/model/PropertyDateType.java | 295 ++ .../vertexvis/model/PropertyDoubleType.java | 294 ++ .../vertexvis/model/PropertyEntryData.java | 314 ++ .../model/PropertyEntryDataAttributes.java | 245 ++ .../PropertyEntryDataAttributesValue.java | 360 ++ .../vertexvis/model/PropertyEntryList.java | 271 ++ .../com/vertexvis/model/PropertyKeyType.java | 301 ++ .../com/vertexvis/model/PropertyLongType.java | 294 ++ .../model/PropertySetRelationship.java | 214 + .../model/PropertySetRelationshipData.java | 298 ++ .../vertexvis/model/PropertyStringType.java | 297 ++ .../java/com/vertexvis/model/QueryAll.java | 8 +- .../vertexvis/model/QueryByCollection.java | 139 +- .../model/QueryByCollectionData.java | 164 +- .../QueryByCollectionDataAttributes.java | 175 +- .../java/com/vertexvis/model/QueryById.java | 139 +- .../com/vertexvis/model/QueryByIdData.java | 164 +- .../model/QueryByIdDataAttributes.java | 167 +- .../java/com/vertexvis/model/QueuedJob.java | 154 +- .../com/vertexvis/model/QueuedJobData.java | 192 +- .../model/QueuedJobDataAttributes.java | 184 +- .../com/vertexvis/model/QueuedJobList.java | 168 +- .../vertexvis/model/QueuedTranslationJob.java | 191 +- .../model/QueuedTranslationJobData.java | 210 +- .../QueuedTranslationJobDataAttributes.java | 198 +- ...QueuedTranslationJobDataRelationships.java | 169 +- .../QueuedTranslationJobIncludedInner.java | 319 ++ .../com/vertexvis/model/RelationshipData.java | 158 +- .../vertexvis/model/RelationshipLinks.java | 140 +- .../model/RevokeOAuth2TokenRequest.java | 139 +- .../model/RevokeOAuth2TokenRequestData.java | 157 +- ...evokeOAuth2TokenRequestDataAttributes.java | 140 +- src/main/java/com/vertexvis/model/Scene.java | 154 +- .../com/vertexvis/model/SceneAlteration.java | 154 +- .../vertexvis/model/SceneAlterationData.java | 209 +- .../SceneAlterationDataRelationships.java | 139 +- .../vertexvis/model/SceneAlterationList.java | 168 +- .../com/vertexvis/model/SceneAnnotation.java | 252 ++ .../model/SceneAnnotationCalloutDataType.java | 335 ++ .../model/SceneAnnotationCustomDataType.java | 276 ++ .../vertexvis/model/SceneAnnotationData.java | 315 ++ .../model/SceneAnnotationDataAttributes.java | 301 ++ .../vertexvis/model/SceneAnnotationSet.java | 252 ++ .../model/SceneAnnotationSetData.java | 315 ++ .../SceneAnnotationSetDataAttributes.java | 300 ++ .../model/SceneAnnotationSetList.java | 271 ++ .../java/com/vertexvis/model/SceneData.java | 192 +- .../vertexvis/model/SceneDataAttributes.java | 292 +- .../java/com/vertexvis/model/SceneItem.java | 154 +- .../com/vertexvis/model/SceneItemData.java | 209 +- .../model/SceneItemDataAttributes.java | 298 +- .../model/SceneItemDataRelationships.java | 186 +- .../SceneItemDataRelationshipsSource.java | 360 ++ .../com/vertexvis/model/SceneItemList.java | 168 +- .../vertexvis/model/SceneItemOverride.java | 154 +- .../model/SceneItemOverrideData.java | 209 +- .../SceneItemOverrideDataAttributes.java | 229 +- .../SceneItemOverrideDataRelationships.java | 156 +- .../model/SceneItemOverrideList.java | 168 +- .../model/SceneItemRelationship.java | 140 +- .../model/SceneItemRelationshipData.java | 165 +- .../java/com/vertexvis/model/SceneList.java | 168 +- .../com/vertexvis/model/SceneOperation.java | 184 +- .../model/SceneOperationOperationsInner.java | 822 ++++ .../vertexvis/model/SceneOperationQuery.java | 314 ++ .../vertexvis/model/SceneRelationship.java | 140 +- .../model/SceneRelationshipData.java | 165 +- .../java/com/vertexvis/model/SceneSync.java | 154 +- .../com/vertexvis/model/SceneSyncData.java | 192 +- .../model/SceneSyncDataAttributes.java | 170 +- .../model/SceneSyncItemResultData.java | 209 +- .../SceneSyncItemResultDataAttributes.java | 158 +- .../SceneSyncItemResultDataRelationships.java | 156 +- .../model/SceneSyncItemResultsList.java | 196 +- .../java/com/vertexvis/model/SceneView.java | 154 +- .../com/vertexvis/model/SceneViewData.java | 192 +- .../model/SceneViewDataAttributes.java | 213 +- .../model/SceneViewDataRelationships.java | 139 +- .../com/vertexvis/model/SceneViewItem.java | 185 +- .../com/vertexvis/model/SceneViewList.java | 168 +- .../model/SceneViewRelationship.java | 140 +- .../model/SceneViewRelationshipData.java | 165 +- .../com/vertexvis/model/SceneViewState.java | 154 +- .../vertexvis/model/SceneViewStateData.java | 192 +- .../model/SceneViewStateDataAttributes.java | 262 +- .../vertexvis/model/SceneViewStateList.java | 168 +- .../model/SceneViewStateRelationship.java | 140 +- .../model/SceneViewStateRelationshipData.java | 165 +- .../com/vertexvis/model/SectionPlane.java | 154 +- .../java/com/vertexvis/model/SelectOp.java | 147 +- .../java/com/vertexvis/model/StreamKey.java | 154 +- .../com/vertexvis/model/StreamKeyData.java | 209 +- .../model/StreamKeyDataAttributes.java | 183 +- .../com/vertexvis/model/StreamKeyList.java | 168 +- .../com/vertexvis/model/ThumbnailData.java | 170 +- .../model/TranslationInspectionJob.java | 154 +- .../model/TranslationInspectionJobData.java | 175 +- ...ranslationInspectionJobDataAttributes.java | 164 +- .../vertexvis/model/UpdateAccountRequest.java | 139 +- .../model/UpdateAccountRequestData.java | 157 +- .../UpdateAccountRequestDataAttributes.java | 175 +- .../model/UpdateApplicationRequest.java | 139 +- .../model/UpdateApplicationRequestData.java | 157 +- ...pdateApplicationRequestDataAttributes.java | 152 +- .../vertexvis/model/UpdateFileRequest.java | 214 + .../model/UpdateFileRequestData.java | 245 ++ .../UpdateFileRequestDataAttributes.java | 216 + ...UpdateItemToDefaultRenditionOperation.java | 166 +- .../model/UpdatePartRevisionRequest.java | 139 +- .../model/UpdatePartRevisionRequestData.java | 200 +- ...datePartRevisionRequestDataAttributes.java | 218 +- ...ionRequestDataAttributesMetadataValue.java | 405 ++ ...ePartRevisionRequestDataRelationships.java | 240 ++ .../model/UpdateSceneAnnotationRequest.java | 214 + .../UpdateSceneAnnotationRequestData.java | 245 ++ ...eSceneAnnotationRequestDataAttributes.java | 250 ++ .../model/UpdateSceneItemOverrideRequest.java | 139 +- .../UpdateSceneItemOverrideRequestData.java | 175 +- ...ceneItemOverrideRequestDataAttributes.java | 207 +- .../model/UpdateSceneItemRequest.java | 139 +- .../model/UpdateSceneItemRequestData.java | 175 +- .../UpdateSceneItemRequestDataAttributes.java | 248 +- ...dateSceneItemRequestDataRelationships.java | 152 +- ...eneItemRequestDataRelationshipsSource.java | 268 ++ .../vertexvis/model/UpdateSceneRequest.java | 139 +- .../model/UpdateSceneRequestData.java | 157 +- .../UpdateSceneRequestDataAttributes.java | 271 +- .../model/UpdateSceneViewRequest.java | 139 +- .../model/UpdateSceneViewRequestData.java | 157 +- .../UpdateSceneViewRequestDataAttributes.java | 170 +- ...eSceneViewRequestDataAttributesCamera.java | 315 ++ .../model/UpdateSceneViewStateRequest.java | 139 +- .../UpdateSceneViewStateRequestData.java | 157 +- .../UpdateWebhookSubscriptionRequest.java | 139 +- .../UpdateWebhookSubscriptionRequestData.java | 157 +- ...hookSubscriptionRequestDataAttributes.java | 178 +- .../model/UpsertPropertyEntriesRequest.java | 214 + .../UpsertPropertyEntriesRequestData.java | 276 ++ ...tPropertyEntriesRequestDataAttributes.java | 222 + ...riesRequestDataAttributesEntriesValue.java | 414 ++ ...opertyEntriesRequestDataRelationships.java | 214 + ...esRequestDataRelationshipsPropertySet.java | 360 ++ .../java/com/vertexvis/model/Vector3.java | 168 +- .../java/com/vertexvis/model/Vector4.java | 183 +- .../com/vertexvis/model/ViewDefaultRenOp.java | 147 +- .../com/vertexvis/model/ViewRenByIdOp.java | 165 +- .../model/ViewRenBySuppliedIdOp.java | 165 +- .../com/vertexvis/model/ViewRepByIdOp.java | 165 +- .../model/ViewRepByPredefinedIdOp.java | 172 +- .../com/vertexvis/model/WebhookEvent.java | 193 +- .../com/vertexvis/model/WebhookEventData.java | 210 +- .../model/WebhookEventDataAttributes.java | 200 +- .../model/WebhookEventDataRelationships.java | 156 +- .../WebhookEventDataRelationshipsOwner.java | 158 +- ...ebhookEventDataRelationshipsOwnerData.java | 165 +- ...WebhookEventDataRelationshipsResource.java | 158 +- ...ookEventDataRelationshipsResourceData.java | 158 +- .../model/WebhookEventIncludedInner.java | 280 ++ ...okEventPartRevisionIncludedAttributes.java | 180 +- .../WebhookEventPartRevisionIncludedData.java | 194 +- .../WebhookEventSceneIncludedAttributes.java | 130 +- .../model/WebhookEventSceneIncludedData.java | 194 +- .../vertexvis/model/WebhookSubscription.java | 154 +- .../model/WebhookSubscriptionData.java | 192 +- .../WebhookSubscriptionDataAttributes.java | 221 +- .../model/WebhookSubscriptionList.java | 168 +- .../AnyOfCameraCameraFitTypeAdapter.java | 28 - ...OperationDeselectOperationTypeAdapter.java | 34 - ...nyOfCreateSceneItemRequestDataAdapter.java | 29 - ...ipPartAssemblyRelationshipTypeAdapter.java | 94 - ...isionDataPartRenditionDataTypeAdapter.java | 64 - ...ationshipSceneRelationshipTypeAdapter.java | 77 - ...ipPartRevisionRelationshipTypeAdapter.java | 69 - ...dataStringTypeMetadataNullTypeAdapter.java | 158 - ...rthographicCameraCameraFitTypeAdapter.java | 33 - ...dQueryByCollectionQueryAllTypeAdapter.java | 30 - .../AnyOfRelationshipDataApiErrorAdapter.java | 96 - ...neItemDataPartRevisionDataTypeAdapter.java | 30 - ...veCameraOrthographicCameraTypeAdapter.java | 58 - ...SceneViewStateRelationshipTypeAdapter.java | 70 - ...oDefaultRenditionOperationTypeAdapter.java | 50 - ...ntPartRevisionIncludedDataTypeAdapter.java | 50 - 452 files changed, 68353 insertions(+), 12576 deletions(-) create mode 100644 src/main/java/com/vertexvis/api/ModelViewsApi.java create mode 100644 src/main/java/com/vertexvis/api/PartRevisionInstancesApi.java create mode 100644 src/main/java/com/vertexvis/api/PmiApi.java create mode 100644 src/main/java/com/vertexvis/api/PropertyEntriesApi.java create mode 100644 src/main/java/com/vertexvis/api/SceneAnnotationsApi.java delete mode 100644 src/main/java/com/vertexvis/example/CallbackUtil.java delete mode 100644 src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java delete mode 100644 src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java delete mode 100644 src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java delete mode 100644 src/main/java/com/vertexvis/example/CreateSceneExample.java delete mode 100644 src/main/java/com/vertexvis/example/JobPoller.java delete mode 100644 src/main/java/com/vertexvis/example/MetadataUtil.java delete mode 100644 src/main/java/com/vertexvis/example/PartCreator.java delete mode 100644 src/main/java/com/vertexvis/example/SceneCreator.java delete mode 100644 src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java create mode 100644 src/main/java/com/vertexvis/model/AbstractOpenApiSchema.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfCameraCameraFit.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfCreateSceneItemRequestData.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationship.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionData.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationship.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraCameraFit.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAll.java delete mode 100644 src/main/java/com/vertexvis/model/AnyOfRelationshipDataApiError.java create mode 100644 src/main/java/com/vertexvis/model/BatchVertexvisBatchResultsInner.java delete mode 100644 src/main/java/com/vertexvis/model/Camera.java create mode 100644 src/main/java/com/vertexvis/model/CreateExportRequestDataAttributesConfig.java create mode 100644 src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationRequest.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestData.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributesData.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequest.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestData.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationshipsSource.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneSyncRequestOperation.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributesCamera.java create mode 100644 src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationshipsSource.java create mode 100644 src/main/java/com/vertexvis/model/FilterExpression.java create mode 100644 src/main/java/com/vertexvis/model/HitIncludedInner.java create mode 100644 src/main/java/com/vertexvis/model/ModelView.java create mode 100644 src/main/java/com/vertexvis/model/ModelViewData.java create mode 100644 src/main/java/com/vertexvis/model/ModelViewDataRelationships.java create mode 100644 src/main/java/com/vertexvis/model/ModelViewList.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfCADExportConfig.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionData.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCamera.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationship.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfUpdateItemToDefaultRenditionOperation.java delete mode 100644 src/main/java/com/vertexvis/model/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.java create mode 100644 src/main/java/com/vertexvis/model/PartInstanceRelationship.java create mode 100644 src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java create mode 100644 src/main/java/com/vertexvis/model/PartRevisionInstanceData.java create mode 100644 src/main/java/com/vertexvis/model/PartRevisionInstanceDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/PartRevisionInstanceDataRelationships.java create mode 100644 src/main/java/com/vertexvis/model/PartRevisionInstanceList.java create mode 100644 src/main/java/com/vertexvis/model/PmiAnnotationData.java create mode 100644 src/main/java/com/vertexvis/model/PmiAnnotationList.java create mode 100644 src/main/java/com/vertexvis/model/PropertyDateType.java create mode 100644 src/main/java/com/vertexvis/model/PropertyDoubleType.java create mode 100644 src/main/java/com/vertexvis/model/PropertyEntryData.java create mode 100644 src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java create mode 100644 src/main/java/com/vertexvis/model/PropertyEntryList.java create mode 100644 src/main/java/com/vertexvis/model/PropertyKeyType.java create mode 100644 src/main/java/com/vertexvis/model/PropertyLongType.java create mode 100644 src/main/java/com/vertexvis/model/PropertySetRelationship.java create mode 100644 src/main/java/com/vertexvis/model/PropertySetRelationshipData.java create mode 100644 src/main/java/com/vertexvis/model/PropertyStringType.java create mode 100644 src/main/java/com/vertexvis/model/QueuedTranslationJobIncludedInner.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotation.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationCalloutDataType.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationCustomDataType.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationData.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationSet.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationSetData.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationSetDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/SceneAnnotationSetList.java create mode 100644 src/main/java/com/vertexvis/model/SceneItemDataRelationshipsSource.java create mode 100644 src/main/java/com/vertexvis/model/SceneOperationOperationsInner.java create mode 100644 src/main/java/com/vertexvis/model/SceneOperationQuery.java create mode 100644 src/main/java/com/vertexvis/model/UpdateFileRequest.java create mode 100644 src/main/java/com/vertexvis/model/UpdateFileRequestData.java create mode 100644 src/main/java/com/vertexvis/model/UpdateFileRequestDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java create mode 100644 src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataRelationships.java create mode 100644 src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequest.java create mode 100644 src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestData.java create mode 100644 src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java create mode 100644 src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributesCamera.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequest.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestData.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributes.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributesEntriesValue.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationships.java create mode 100644 src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationshipsPropertySet.java create mode 100644 src/main/java/com/vertexvis/model/WebhookEventIncludedInner.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfCameraCameraFitTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfCreateSceneItemRequestDataAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/AnyOfRelationshipDataApiErrorAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/OneOfPerspectiveCameraOrthographicCameraTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/OneOfUpdateItemToDefaultRenditionOperationTypeAdapter.java delete mode 100644 src/main/java/com/vertexvis/model/serialization/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0f63684..6a183db 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.github/workflows/maven.yml api/openapi.yaml gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties @@ -24,11 +25,16 @@ src/main/java/com/vertexvis/api/ExportsApi.java src/main/java/com/vertexvis/api/FilesApi.java src/main/java/com/vertexvis/api/GeometrySetsApi.java src/main/java/com/vertexvis/api/HitsApi.java +src/main/java/com/vertexvis/api/ModelViewsApi.java src/main/java/com/vertexvis/api/Oauth2Api.java src/main/java/com/vertexvis/api/PartRenditionsApi.java +src/main/java/com/vertexvis/api/PartRevisionInstancesApi.java src/main/java/com/vertexvis/api/PartRevisionsApi.java src/main/java/com/vertexvis/api/PartsApi.java +src/main/java/com/vertexvis/api/PmiApi.java +src/main/java/com/vertexvis/api/PropertyEntriesApi.java src/main/java/com/vertexvis/api/SceneAlterationsApi.java +src/main/java/com/vertexvis/api/SceneAnnotationsApi.java src/main/java/com/vertexvis/api/SceneItemOverridesApi.java src/main/java/com/vertexvis/api/SceneItemsApi.java src/main/java/com/vertexvis/api/SceneSynchronizationsApi.java @@ -46,6 +52,7 @@ src/main/java/com/vertexvis/auth/OAuth.java src/main/java/com/vertexvis/auth/OAuthFlow.java src/main/java/com/vertexvis/auth/OAuthOkHttpClient.java src/main/java/com/vertexvis/auth/RetryingOAuth.java +src/main/java/com/vertexvis/model/AbstractOpenApiSchema.java src/main/java/com/vertexvis/model/Account.java src/main/java/com/vertexvis/model/AccountData.java src/main/java/com/vertexvis/model/AccountDataAttributes.java @@ -68,6 +75,7 @@ src/main/java/com/vertexvis/model/ApplicationList.java src/main/java/com/vertexvis/model/Batch.java src/main/java/com/vertexvis/model/BatchOperation.java src/main/java/com/vertexvis/model/BatchOperationRef.java +src/main/java/com/vertexvis/model/BatchVertexvisBatchResultsInner.java src/main/java/com/vertexvis/model/BoundingBox.java src/main/java/com/vertexvis/model/CADExportConfig.java src/main/java/com/vertexvis/model/CameraFit.java @@ -89,6 +97,7 @@ src/main/java/com/vertexvis/model/CreateBatchRequest.java src/main/java/com/vertexvis/model/CreateExportRequest.java src/main/java/com/vertexvis/model/CreateExportRequestData.java src/main/java/com/vertexvis/model/CreateExportRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreateExportRequestDataAttributesConfig.java src/main/java/com/vertexvis/model/CreateExportRequestDataRelationships.java src/main/java/com/vertexvis/model/CreateFileRequest.java src/main/java/com/vertexvis/model/CreateFileRequestData.java @@ -106,9 +115,17 @@ src/main/java/com/vertexvis/model/CreatePartRequest.java src/main/java/com/vertexvis/model/CreatePartRequestData.java src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java +src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java src/main/java/com/vertexvis/model/CreateSceneAlterationRequestData.java src/main/java/com/vertexvis/model/CreateSceneAlterationRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationRequest.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestData.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributesData.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequest.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestData.java +src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestDataAttributes.java src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequest.java src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestData.java src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataAttributes.java @@ -117,19 +134,23 @@ src/main/java/com/vertexvis/model/CreateSceneItemRequest.java src/main/java/com/vertexvis/model/CreateSceneItemRequestData.java src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationships.java +src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationshipsSource.java src/main/java/com/vertexvis/model/CreateSceneRequest.java src/main/java/com/vertexvis/model/CreateSceneRequestData.java src/main/java/com/vertexvis/model/CreateSceneRequestDataAttributes.java src/main/java/com/vertexvis/model/CreateSceneRequestDataRelationships.java src/main/java/com/vertexvis/model/CreateSceneSyncRequest.java +src/main/java/com/vertexvis/model/CreateSceneSyncRequestOperation.java src/main/java/com/vertexvis/model/CreateSceneViewRequest.java src/main/java/com/vertexvis/model/CreateSceneViewRequestData.java src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributesCamera.java src/main/java/com/vertexvis/model/CreateSceneViewRequestDataRelationships.java src/main/java/com/vertexvis/model/CreateSceneViewStateRequest.java src/main/java/com/vertexvis/model/CreateSceneViewStateRequestData.java src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataAttributes.java src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationships.java +src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationshipsSource.java src/main/java/com/vertexvis/model/CreateStreamKeyRequest.java src/main/java/com/vertexvis/model/CreateStreamKeyRequestData.java src/main/java/com/vertexvis/model/CreateStreamKeyRequestDataAttributes.java @@ -160,6 +181,7 @@ src/main/java/com/vertexvis/model/FileMetadataData.java src/main/java/com/vertexvis/model/FileMetadataDataAttributes.java src/main/java/com/vertexvis/model/FileRelationship.java src/main/java/com/vertexvis/model/FileRelationshipData.java +src/main/java/com/vertexvis/model/FilterExpression.java src/main/java/com/vertexvis/model/GeometrySet.java src/main/java/com/vertexvis/model/GeometrySetData.java src/main/java/com/vertexvis/model/GeometrySetList.java @@ -169,6 +191,7 @@ src/main/java/com/vertexvis/model/Hit.java src/main/java/com/vertexvis/model/HitData.java src/main/java/com/vertexvis/model/HitDataAttributes.java src/main/java/com/vertexvis/model/HitDataRelationships.java +src/main/java/com/vertexvis/model/HitIncludedInner.java src/main/java/com/vertexvis/model/HitResultData.java src/main/java/com/vertexvis/model/HitResultDataAttributes.java src/main/java/com/vertexvis/model/HitResultDataRelationships.java @@ -181,6 +204,10 @@ src/main/java/com/vertexvis/model/MetadataFloatType.java src/main/java/com/vertexvis/model/MetadataLongType.java src/main/java/com/vertexvis/model/MetadataNullType.java src/main/java/com/vertexvis/model/MetadataStringType.java +src/main/java/com/vertexvis/model/ModelView.java +src/main/java/com/vertexvis/model/ModelViewData.java +src/main/java/com/vertexvis/model/ModelViewDataRelationships.java +src/main/java/com/vertexvis/model/ModelViewList.java src/main/java/com/vertexvis/model/OAuth2BadRequest.java src/main/java/com/vertexvis/model/OAuth2Token.java src/main/java/com/vertexvis/model/Orientation.java @@ -192,6 +219,8 @@ src/main/java/com/vertexvis/model/PartData.java src/main/java/com/vertexvis/model/PartDataAttributes.java src/main/java/com/vertexvis/model/PartDataRelationships.java src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java +src/main/java/com/vertexvis/model/PartInstanceRelationship.java +src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java src/main/java/com/vertexvis/model/PartList.java src/main/java/com/vertexvis/model/PartRelationshipData.java src/main/java/com/vertexvis/model/PartRendition.java @@ -206,11 +235,28 @@ src/main/java/com/vertexvis/model/PartRevisionData.java src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java src/main/java/com/vertexvis/model/PartRevisionDataRelationships.java src/main/java/com/vertexvis/model/PartRevisionInstance.java +src/main/java/com/vertexvis/model/PartRevisionInstanceData.java +src/main/java/com/vertexvis/model/PartRevisionInstanceDataAttributes.java +src/main/java/com/vertexvis/model/PartRevisionInstanceDataRelationships.java +src/main/java/com/vertexvis/model/PartRevisionInstanceList.java src/main/java/com/vertexvis/model/PartRevisionList.java src/main/java/com/vertexvis/model/PartRevisionRelationship.java src/main/java/com/vertexvis/model/PartRevisionSuppliedId.java src/main/java/com/vertexvis/model/PerspectiveCamera.java +src/main/java/com/vertexvis/model/PmiAnnotationData.java +src/main/java/com/vertexvis/model/PmiAnnotationList.java src/main/java/com/vertexvis/model/Point.java +src/main/java/com/vertexvis/model/PropertyDateType.java +src/main/java/com/vertexvis/model/PropertyDoubleType.java +src/main/java/com/vertexvis/model/PropertyEntryData.java +src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java +src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java +src/main/java/com/vertexvis/model/PropertyEntryList.java +src/main/java/com/vertexvis/model/PropertyKeyType.java +src/main/java/com/vertexvis/model/PropertyLongType.java +src/main/java/com/vertexvis/model/PropertySetRelationship.java +src/main/java/com/vertexvis/model/PropertySetRelationshipData.java +src/main/java/com/vertexvis/model/PropertyStringType.java src/main/java/com/vertexvis/model/QueryAll.java src/main/java/com/vertexvis/model/QueryByCollection.java src/main/java/com/vertexvis/model/QueryByCollectionData.java @@ -226,6 +272,7 @@ src/main/java/com/vertexvis/model/QueuedTranslationJob.java src/main/java/com/vertexvis/model/QueuedTranslationJobData.java src/main/java/com/vertexvis/model/QueuedTranslationJobDataAttributes.java src/main/java/com/vertexvis/model/QueuedTranslationJobDataRelationships.java +src/main/java/com/vertexvis/model/QueuedTranslationJobIncludedInner.java src/main/java/com/vertexvis/model/RelationshipData.java src/main/java/com/vertexvis/model/RelationshipLinks.java src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequest.java @@ -236,12 +283,22 @@ src/main/java/com/vertexvis/model/SceneAlteration.java src/main/java/com/vertexvis/model/SceneAlterationData.java src/main/java/com/vertexvis/model/SceneAlterationDataRelationships.java src/main/java/com/vertexvis/model/SceneAlterationList.java +src/main/java/com/vertexvis/model/SceneAnnotation.java +src/main/java/com/vertexvis/model/SceneAnnotationCalloutDataType.java +src/main/java/com/vertexvis/model/SceneAnnotationCustomDataType.java +src/main/java/com/vertexvis/model/SceneAnnotationData.java +src/main/java/com/vertexvis/model/SceneAnnotationDataAttributes.java +src/main/java/com/vertexvis/model/SceneAnnotationSet.java +src/main/java/com/vertexvis/model/SceneAnnotationSetData.java +src/main/java/com/vertexvis/model/SceneAnnotationSetDataAttributes.java +src/main/java/com/vertexvis/model/SceneAnnotationSetList.java src/main/java/com/vertexvis/model/SceneData.java src/main/java/com/vertexvis/model/SceneDataAttributes.java src/main/java/com/vertexvis/model/SceneItem.java src/main/java/com/vertexvis/model/SceneItemData.java src/main/java/com/vertexvis/model/SceneItemDataAttributes.java src/main/java/com/vertexvis/model/SceneItemDataRelationships.java +src/main/java/com/vertexvis/model/SceneItemDataRelationshipsSource.java src/main/java/com/vertexvis/model/SceneItemList.java src/main/java/com/vertexvis/model/SceneItemOverride.java src/main/java/com/vertexvis/model/SceneItemOverrideData.java @@ -252,6 +309,8 @@ src/main/java/com/vertexvis/model/SceneItemRelationship.java src/main/java/com/vertexvis/model/SceneItemRelationshipData.java src/main/java/com/vertexvis/model/SceneList.java src/main/java/com/vertexvis/model/SceneOperation.java +src/main/java/com/vertexvis/model/SceneOperationOperationsInner.java +src/main/java/com/vertexvis/model/SceneOperationQuery.java src/main/java/com/vertexvis/model/SceneRelationship.java src/main/java/com/vertexvis/model/SceneRelationshipData.java src/main/java/com/vertexvis/model/SceneSync.java @@ -291,10 +350,18 @@ src/main/java/com/vertexvis/model/UpdateAccountRequestDataAttributes.java src/main/java/com/vertexvis/model/UpdateApplicationRequest.java src/main/java/com/vertexvis/model/UpdateApplicationRequestData.java src/main/java/com/vertexvis/model/UpdateApplicationRequestDataAttributes.java +src/main/java/com/vertexvis/model/UpdateFileRequest.java +src/main/java/com/vertexvis/model/UpdateFileRequestData.java +src/main/java/com/vertexvis/model/UpdateFileRequestDataAttributes.java src/main/java/com/vertexvis/model/UpdateItemToDefaultRenditionOperation.java src/main/java/com/vertexvis/model/UpdatePartRevisionRequest.java src/main/java/com/vertexvis/model/UpdatePartRevisionRequestData.java src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributes.java +src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java +src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataRelationships.java +src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequest.java +src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestData.java +src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestDataAttributes.java src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequest.java src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestData.java src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestDataAttributes.java @@ -302,17 +369,25 @@ src/main/java/com/vertexvis/model/UpdateSceneItemRequest.java src/main/java/com/vertexvis/model/UpdateSceneItemRequestData.java src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationships.java +src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java src/main/java/com/vertexvis/model/UpdateSceneRequest.java src/main/java/com/vertexvis/model/UpdateSceneRequestData.java src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java src/main/java/com/vertexvis/model/UpdateSceneViewRequest.java src/main/java/com/vertexvis/model/UpdateSceneViewRequestData.java src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributes.java +src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributesCamera.java src/main/java/com/vertexvis/model/UpdateSceneViewStateRequest.java src/main/java/com/vertexvis/model/UpdateSceneViewStateRequestData.java src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequest.java src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestData.java src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestDataAttributes.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequest.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestData.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributes.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributesEntriesValue.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationships.java +src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationshipsPropertySet.java src/main/java/com/vertexvis/model/Vector3.java src/main/java/com/vertexvis/model/Vector4.java src/main/java/com/vertexvis/model/ViewDefaultRenOp.java @@ -328,6 +403,7 @@ src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwner.java src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwnerData.java src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResource.java src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResourceData.java +src/main/java/com/vertexvis/model/WebhookEventIncludedInner.java src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedAttributes.java src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedData.java src/main/java/com/vertexvis/model/WebhookEventSceneIncludedAttributes.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 1e20ec3..b23eb27 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -5.4.0 \ No newline at end of file +7.11.0 diff --git a/api/openapi.yaml b/api/openapi.yaml index 8d225c7..480a573 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -32,11 +32,15 @@ tags: - name: files - name: geometry-sets - name: hits +- name: model-views - name: oauth2 - name: part-renditions - name: part-revisions - name: parts +- name: pmi +- name: property-entries - name: scene-alterations +- name: scene-annotations - name: scene-item-overrides - name: scene-items - name: scene-synchronizations @@ -74,7 +78,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -107,8 +111,9 @@ paths: - accounts.write tags: - accounts - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /accounts/{id}: delete: description: Delete an `account`. @@ -165,7 +170,8 @@ paths: - accounts.write tags: - accounts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get an `account`. operationId: getAccount @@ -225,7 +231,8 @@ paths: - accounts.read tags: - accounts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update an `account`. operationId: updateAccount @@ -258,7 +265,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -302,8 +309,9 @@ paths: - accounts.write tags: - accounts - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /accounts/{id}/applications: post: description: Create an `application` for an `account`. @@ -340,7 +348,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -385,8 +393,9 @@ paths: tags: - accounts x-scala-package: accounts - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /applications: get: description: Get `applications`. @@ -395,7 +404,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -404,7 +413,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -416,10 +425,10 @@ paths: - description: Comma-separated list of client IDs to filter on. explode: true in: query - name: filter[clientId] + name: "filter[clientId]" required: false schema: - example: ?filter[clientId]=some-id-1&filter[clientId]=some-id-2 + example: "?filter[clientId]=some-id-1&filter[clientId]=some-id-2" maxLength: 1024 type: string style: form @@ -457,7 +466,8 @@ paths: - OAuth2: [] tags: - applications - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: description: Create an OAuth2 `application`. operationId: createApplication @@ -484,7 +494,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -515,8 +525,9 @@ paths: - OAuth2: [] tags: - applications - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /applications/{id}: delete: description: Delete an `application`. @@ -571,7 +582,8 @@ paths: - OAuth2: [] tags: - applications - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get an `application`. operationId: getApplication @@ -629,7 +641,8 @@ paths: - OAuth2: [] tags: - applications - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update an `application`. operationId: updateApplication @@ -662,7 +675,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -704,12 +717,13 @@ paths: - OAuth2: [] tags: - applications - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /batches: post: - description: Create a `batch`. This API is asynchronous, returning the location - of a `queued-batch`. Check the status via the getQueuedBatch API. + description: "Create a `batch`. This API is asynchronous, returning the location\ + \ of a `queued-batch`. Check the status via the getQueuedBatch API." operationId: createBatch requestBody: content: @@ -734,7 +748,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -765,8 +779,9 @@ paths: - OAuth2: [] tags: - batches - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /batches/{id}: get: description: Get a `batch` by ID. @@ -825,11 +840,12 @@ paths: - OAuth2: [] tags: - batches - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-batches/{id}: get: - description: Get a `queued-batch`. The response is either the status if `running` - or `error` or, upon completion, redirects to the created `batch`. + description: "Get a `queued-batch`. The response is either the status if `running`\ + \ or `error` or, upon completion, redirects to the created `batch`." operationId: getQueuedBatch parameters: - description: The `queued-batch` ID. @@ -887,7 +903,8 @@ paths: - OAuth2: [] tags: - batches - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /files: get: description: Get `files`. @@ -896,7 +913,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -905,7 +922,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -917,10 +934,10 @@ paths: - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form @@ -958,11 +975,12 @@ paths: - OAuth2: [] tags: - files - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: - description: Create a `file`. Once created, upload file content via the uploadFile - API. For details including supported file formats, see our [Import data](https://developer.vertexvis.com/docs/guides/import-data-with-api) - guide. + description: "Create a `file`. Once created, upload file content via the uploadFile\ + \ API. For details including supported file formats, see our [Import data](https://developer.vertexvis.com/docs/guides/import-data-with-api)\ + \ guide." operationId: createFile requestBody: content: @@ -987,7 +1005,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1018,8 +1036,9 @@ paths: - OAuth2: [] tags: - files - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /files/{id}: delete: description: Delete a `file`. @@ -1078,7 +1097,8 @@ paths: - OAuth2: [] tags: - files - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `file` by ID. operationId: getFile @@ -1136,10 +1156,88 @@ paths: - OAuth2: [] tags: - files - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json + patch: + description: Update a `file`. + operationId: updateFile + parameters: + - description: The `file` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UpdateFileRequest' + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/FileMetadata' + description: OK + "400": + content: + application/vnd.api+json: + example: + errors: + - status: "400" + code: BadRequest + title: "Invalid, missing, or out-of-range request parameters." + schema: + $ref: '#/components/schemas/Failure' + description: Bad Request + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - files + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: - description: Upload a `file`. Once uploaded, create either parts or geometry - sets via the createPart or createGeometrySet APIs. + description: "Upload a `file`. Once uploaded, create either parts or geometry\ + \ sets via the createPart or createGeometrySet APIs." operationId: uploadFile parameters: - description: The `file` ID. @@ -1167,7 +1265,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1209,8 +1307,9 @@ paths: - OAuth2: [] tags: - files - x-contentType: application/octet-stream - x-accepts: application/vnd.api+json + x-content-type: application/octet-stream + x-accepts: + - application/vnd.api+json /geometry-sets: get: description: Get `geometry-sets`. @@ -1219,7 +1318,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -1228,7 +1327,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -1271,11 +1370,12 @@ paths: - OAuth2: [] tags: - geometry-sets - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: - description: Create a `geometry-set`. Once created, create scenes via the createScene - API. For details, see our [Import data](https://developer.vertexvis.com/docs/guides/import-data-with-api) - guide. + description: "Create a `geometry-set`. Once created, create scenes via the createScene\ + \ API. For details, see our [Import data](https://developer.vertexvis.com/docs/guides/import-data-with-api)\ + \ guide." operationId: createGeometrySet requestBody: content: @@ -1300,7 +1400,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1331,8 +1431,9 @@ paths: - OAuth2: [] tags: - geometry-sets - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /geometry-sets/{id}: get: description: Get a `geometry-set` by ID. @@ -1391,7 +1492,8 @@ paths: - OAuth2: [] tags: - geometry-sets - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-views/{id}/hits: post: description: Create a `hit` for a `scene-view`. @@ -1415,15 +1517,15 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. Due to its potential size, metadata is only returned - if explicitly requested. + - description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. Due to its potential size, metadata is only returned\ + \ if explicitly requested." explode: true in: query - name: fields[part-revision] + name: "fields[part-revision]" required: false schema: - example: created,suppliedId,metadata + example: "created,suppliedId,metadata" maxLength: 32 type: string style: form @@ -1450,7 +1552,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1492,8 +1594,9 @@ paths: - OAuth2: [] tags: - hits - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}/hits: post: description: Create a `hit` for a `scene`. @@ -1517,15 +1620,15 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. Due to its potential size, metadata is only returned - if explicitly requested. + - description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. Due to its potential size, metadata is only returned\ + \ if explicitly requested." explode: true in: query - name: fields[part-revision] + name: "fields[part-revision]" required: false schema: - example: created,suppliedId,metadata + example: "created,suppliedId,metadata" maxLength: 32 type: string style: form @@ -1552,7 +1655,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1594,12 +1697,13 @@ paths: - OAuth2: [] tags: - hits - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /oauth2/token: post: - description: Create an OAuth2 access token. For details, see our [Authentication](https://developer.vertexvis.com/docs/guides/authentication) - guide. + description: "Create an OAuth2 access token. For details, see our [Authentication](https://developer.vertexvis.com/docs/guides/authentication)\ + \ guide." operationId: createToken requestBody: content: @@ -1624,8 +1728,9 @@ paths: - basicAuth: [] tags: - oauth2 - x-contentType: application/x-www-form-urlencoded - x-accepts: application/vnd.api+json + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/vnd.api+json /oauth2/revoke: post: description: Revoke an OAuth2 access token. @@ -1643,8 +1748,9 @@ paths: - basicAuth: [] tags: - oauth2 - x-contentType: application/vnd.api+json - x-accepts: application/json + x-content-type: application/vnd.api+json + x-accepts: + - application/json /oauth2/auth/requests/login/accept: post: description: Accept Login Challenge with subject & login challenge @@ -1678,7 +1784,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1698,8 +1804,9 @@ paths: - admin-login tags: - oauth2 - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /oauth2/auth/requests/consent/accept: post: description: Accept Consent Challenge to login. @@ -1733,7 +1840,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -1753,8 +1860,9 @@ paths: - admin-login tags: - oauth2 - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /part-renditions: get: description: Get `part-renditions` with an optional filter. @@ -1763,7 +1871,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -1772,7 +1880,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -1784,17 +1892,17 @@ paths: - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form - description: A revision ID to filter on. explode: true in: query - name: filter[revisionId] + name: "filter[revisionId]" required: false schema: $ref: '#/components/schemas/Uuid' @@ -1833,7 +1941,8 @@ paths: - OAuth2: [] tags: - part-renditions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /part-renditions/{id}: get: description: Get a `part-rendition` by ID. @@ -1892,7 +2001,8 @@ paths: - OAuth2: [] tags: - part-renditions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /part-revisions/{id}: delete: description: Delete a `part-revision`. @@ -1954,7 +2064,8 @@ paths: - OAuth2: [] tags: - part-revisions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `part-revision` by ID. operationId: getPartRevision @@ -1967,15 +2078,15 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. Due to its potential size, metadata is only returned - if explicitly requested. + - description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. Due to its potential size, metadata is only returned\ + \ if explicitly requested." explode: true in: query - name: fields[part-revision] + name: "fields[part-revision]" required: false schema: - example: created,suppliedId,metadata + example: "created,suppliedId,metadata" maxLength: 32 type: string style: form @@ -2025,7 +2136,8 @@ paths: tags: - part-revisions x-scala-package: translations - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: "Update a `part-revision`. When given a `file` relationship as\ \ a payload, this will invoke a translation job, similar to the POST /parts\ @@ -2081,7 +2193,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -2123,8 +2235,9 @@ paths: - OAuth2: [] tags: - part-revisions - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /part-revisions/{id}/part-renditions: post: operationId: createPartRendition @@ -2166,7 +2279,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -2208,8 +2321,9 @@ paths: - OAuth2: [] tags: - part-renditions - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /part-revisions/{id}/image: get: description: Get a rendered image of a `part-revision`. @@ -2250,7 +2364,7 @@ paths: - description: The `camera` position vector. explode: true in: query - name: camera[position] + name: "camera[position]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2258,7 +2372,7 @@ paths: - description: The `camera` up vector. explode: true in: query - name: camera[up] + name: "camera[up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2266,7 +2380,7 @@ paths: - description: The `camera` lookAt vector. explode: true in: query - name: camera[lookAt] + name: "camera[lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2274,7 +2388,7 @@ paths: - description: The perspective camera position. explode: true in: query - name: camera[perspective][position] + name: "camera[perspective][position]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2282,7 +2396,7 @@ paths: - description: The perspective camera look at position. explode: true in: query - name: camera[perspective][lookAt] + name: "camera[perspective][lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2290,7 +2404,7 @@ paths: - description: The perspective camera up vector. explode: true in: query - name: camera[perspective][up] + name: "camera[perspective][up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2298,7 +2412,7 @@ paths: - description: The orthographic camera view vector. explode: true in: query - name: camera[orthographic][viewVector] + name: "camera[orthographic][viewVector]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2306,7 +2420,7 @@ paths: - description: The orthographic camera look at position. explode: true in: query - name: camera[orthographic][lookAt] + name: "camera[orthographic][lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2314,7 +2428,7 @@ paths: - description: The orthographic camera up vector. explode: true in: query - name: camera[orthographic][up] + name: "camera[orthographic][up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -2322,7 +2436,7 @@ paths: - description: The orthographic field-of-view height. explode: true in: query - name: camera[orthographic][fovHeight] + name: "camera[orthographic][fovHeight]" required: false schema: exclusiveMinimum: true @@ -2390,7 +2504,107 @@ paths: - OAuth2: [] tags: - part-revisions - x-accepts: application/vnd.api+json,image/jpeg,image/png + x-accepts: + - application/vnd.api+json + - image/jpeg + - image/png + /part-revision-instances: + get: + description: | + Gets a page of 'part-revision' instances. An instance is an occurence of a revision that is a child of a parent revision. The returned data will have the ordinal used for ordering and the transform matrix for each occurrence. + operationId: getPartRevisionInstanceList + parameters: + - description: Parent ID to filter on. + explode: true + in: query + name: "filter[parent]" + required: false + schema: + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + style: form + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/PartRevisionInstanceList' + description: OK + "400": + content: + application/vnd.api+json: + example: + errors: + - status: "400" + code: BadRequest + title: "Invalid, missing, or out-of-range request parameters." + schema: + $ref: '#/components/schemas/Failure' + description: Bad Request + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - part-revision-instances + x-scala-package: translations + x-accepts: + - application/vnd.api+json /parts/{id}/part-revisions: get: description: Get `part-revisions` for a `part`. @@ -2407,7 +2621,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -2416,7 +2630,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -2428,10 +2642,10 @@ paths: - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form @@ -2480,7 +2694,8 @@ paths: - OAuth2: [] tags: - part-revisions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /parts: get: description: Get `parts`. @@ -2489,7 +2704,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -2498,7 +2713,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -2510,10 +2725,10 @@ paths: - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form @@ -2551,7 +2766,8 @@ paths: - OAuth2: [] tags: - parts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: description: "Create a `part`.\n\nThis endpoint includes multiple successful\ \ response codes: [`201`, `202`].\n\nWhen not given a relationship, this endpoint\ @@ -2598,7 +2814,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -2629,8 +2845,9 @@ paths: - OAuth2: [] tags: - parts - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /parts/{id}: delete: description: Delete a `part`. @@ -2692,7 +2909,8 @@ paths: - OAuth2: [] tags: - parts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `part` by ID. operationId: getPart @@ -2760,7 +2978,8 @@ paths: - OAuth2: [] tags: - parts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-part-deletions/{id}: get: description: Get a `queued-part-deletion` by ID. @@ -2819,7 +3038,8 @@ paths: - OAuth2: [] tags: - parts - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-part-revision-deletions/{id}: get: description: Get a `queued-part-revision-deletion` by ID. @@ -2878,13 +3098,14 @@ paths: - OAuth2: [] tags: - part-revisions - x-accepts: application/vnd.api+json - /scene-alterations/{id}: + x-accepts: + - application/vnd.api+json + /model-views/{id}: get: - description: Get a `scene-alteration` by ID. - operationId: getSceneAlteration + description: Get the details of a `model-view`. + operationId: getModelView parameters: - - description: The `scene-alteration` ID. + - description: The `model-view` ID. explode: false in: path name: id @@ -2897,7 +3118,7 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/SceneAlteration' + $ref: '#/components/schemas/ModelView' description: OK "401": content: @@ -2936,14 +3157,15 @@ paths: security: - OAuth2: [] tags: - - scene-alterations - x-accepts: application/vnd.api+json - /scene-views/{id}/scene-alterations: + - model-views + x-accepts: + - application/vnd.api+json + /part-revisions/{id}/model-views: get: - description: Get `scene-alterations` for a `scene-view`. - operationId: getSceneAlterations + description: Get a paged list of `model-views` for a part revision. + operationId: getPartRevisionModelViews parameters: - - description: The `scene-view` ID. + - description: The `part-revision` ID. explode: false in: path name: id @@ -2951,12 +3173,43 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple + - description: Filter model views that contain or do not contain annotations. + explode: true + in: query + name: "filter[hasAnnotations]" + required: false + schema: + example: true + maxLength: 1024 + type: boolean + style: form + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form responses: "200": content: application/vnd.api+json: schema: - $ref: '#/components/schemas/SceneAlterationList' + $ref: '#/components/schemas/ModelViewList' description: OK "401": content: @@ -2995,13 +3248,15 @@ paths: security: - OAuth2: [] tags: - - scene-alterations - x-accepts: application/vnd.api+json - post: - description: Create a `scene-alteration` for a `scene-view`. - operationId: createSceneAlteration + - model-views + x-accepts: + - application/vnd.api+json + /scene-items/{id}/model-views: + get: + description: Get a paged list of `model-views` for a scene item. + operationId: getSceneItemModelViews parameters: - - description: The `scene-view` ID. + - description: The `scene-item` ID. explode: false in: path name: id @@ -3009,30 +3264,459 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - requestBody: - content: - application/vnd.api+json: - schema: - $ref: '#/components/schemas/CreateSceneAlterationRequest' - required: true + - description: Filter model views that contain or do not contain annotations. + explode: true + in: query + name: "filter[hasAnnotations]" + required: false + schema: + example: true + maxLength: 1024 + type: boolean + style: form + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form responses: - "202": + "200": content: application/vnd.api+json: schema: - $ref: '#/components/schemas/QueuedJob' - description: Accepted - headers: - content-location: - $ref: '#/components/headers/ContentLocation' - "400": + $ref: '#/components/schemas/ModelViewList' + description: OK + "401": content: application/vnd.api+json: example: errors: - - status: "400" - code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - model-views + x-accepts: + - application/vnd.api+json + /pmi-annotations: + get: + description: List `pmi-annotation`s. + operationId: getPmiAnnotations + parameters: + - description: Filter annotations belonging to a model view. + explode: true + in: query + name: "filter[modelViewId]" + required: false + schema: + $ref: '#/components/schemas/Uuid' + style: form + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/PmiAnnotationList' + description: OK + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - pmi + x-accepts: + - application/vnd.api+json + /property-entries: + get: + description: | + Get `property-entries` by a resource ID **Preview:** This is a preview API and is subject to change. + operationId: getPropertyEntries + parameters: + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form + - description: A resource ID to filter on + explode: true + in: query + name: "filter[resourceId]" + required: false + schema: + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + style: form + - description: The provided type for the resource ids + explode: true + in: query + name: "filter[resourceType]" + required: false + schema: + example: part-revision + maxLength: 36 + type: string + style: form + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/PropertyEntryList' + description: OK + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - property-entries + x-accepts: + - application/vnd.api+json + patch: + description: | + Upsert property-entries for a provided resource. + **Preview:** This is a preview API and is subject to change. + operationId: upsertPropertyEntries + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UpsertPropertyEntriesRequest' + required: true + responses: + "204": + description: No Content + "400": + content: + application/vnd.api+json: + example: + errors: + - status: "400" + code: BadRequest + title: "Invalid, missing, or out-of-range request parameters." + schema: + $ref: '#/components/schemas/Failure' + description: Bad Request + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + security: + - OAuth2: [] + tags: + - property-entries + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scene-alterations/{id}: + get: + description: Get a `scene-alteration` by ID. + operationId: getSceneAlteration + parameters: + - description: The `scene-alteration` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/SceneAlteration' + description: OK + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - scene-alterations + x-accepts: + - application/vnd.api+json + /scene-views/{id}/scene-alterations: + get: + description: Get `scene-alterations` for a `scene-view`. + operationId: getSceneAlterations + parameters: + - description: The `scene-view` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/SceneAlterationList' + description: OK + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - scene-alterations + x-accepts: + - application/vnd.api+json + post: + description: Create a `scene-alteration` for a `scene-view`. + operationId: createSceneAlteration + parameters: + - description: The `scene-view` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/CreateSceneAlterationRequest' + required: true + responses: + "202": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/QueuedJob' + description: Accepted + headers: + content-location: + $ref: '#/components/headers/ContentLocation' + "400": + content: + application/vnd.api+json: + example: + errors: + - status: "400" + code: BadRequest + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -3074,8 +3758,9 @@ paths: - OAuth2: [] tags: - scene-alterations - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-scene-alterations/{id}: get: description: Get a `queued-scene-alteration` by ID. @@ -3136,7 +3821,8 @@ paths: - OAuth2: [] tags: - scene-alterations - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-item-overrides/{id}: delete: description: Delete a `scene-item-override`. @@ -3191,7 +3877,8 @@ paths: - OAuth2: [] tags: - scene-item-overrides - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update a `scene-item-override`. operationId: updateSceneItemOverride @@ -3224,7 +3911,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -3266,8 +3953,9 @@ paths: - OAuth2: [] tags: - scene-item-overrides - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-views/{id}/scene-item-overrides: get: description: Get `scene-item-overrides` for a `scene-view`. @@ -3284,7 +3972,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -3293,7 +3981,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -3347,7 +4035,8 @@ paths: - OAuth2: [] tags: - scene-item-overrides - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: description: Create a `scene-item-override` for a `scene-view`. operationId: createSceneItemOverride @@ -3383,7 +4072,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -3425,8 +4114,9 @@ paths: - OAuth2: [] tags: - scene-item-overrides - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-items/{id}: delete: description: Delete a `scene-item`. @@ -3481,7 +4171,8 @@ paths: - OAuth2: [] tags: - scene-items - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `scene-item` by ID. operationId: getSceneItem @@ -3494,15 +4185,15 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. `boundingBox`, `worldTransform` and `metadata` - are only returned if explicitly requested. + - description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. `boundingBox`, `worldTransform` and `metadata`\ + \ are only returned if explicitly requested." explode: true in: query - name: fields[scene-item] + name: "fields[scene-item]" required: false schema: - example: created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata + example: "created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata" type: string style: form responses: @@ -3550,7 +4241,8 @@ paths: - OAuth2: [] tags: - scene-items - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update a `scene-item`. operationId: updateSceneItem @@ -3586,7 +4278,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -3628,8 +4320,9 @@ paths: - OAuth2: [] tags: - scene-items - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}/scene-items: get: description: Get `scene-items` for a `scene`. @@ -3646,7 +4339,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -3655,7 +4348,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -3664,30 +4357,32 @@ paths: minimum: 1 type: integer style: form - - description: Source ID to filter on. + - allowEmptyValue: true + description: Source ID to filter on. explode: true in: query - name: filter[source] + name: "filter[source]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 maxLength: 1024 + nullable: true type: string style: form - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form - description: Parent ID to filter on. explode: true in: query - name: filter[parent] + name: "filter[parent]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 @@ -3740,7 +4435,8 @@ paths: - OAuth2: [] tags: - scene-items - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: description: |- Create a `scene-item` for a `scene`. Provide the source geometry either via `part-revision` or `geometry-set` UUID using `relationship.source` or by supplied IDs using `attributes.source`. @@ -3780,7 +4476,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -3833,15 +4529,16 @@ paths: - OAuth2: [] tags: - scene-items - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-scene-items/{id}: get: - description: Get a `queued-scene-item`. The response is either the status if - `running` or `error` or, upon completion, redirects to the created `scene-item`. - Once created, commit the scene via the updateScene API. For details, see our - [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) - guide. + description: "Get a `queued-scene-item`. The response is either the status if\ + \ `running` or `error` or, upon completion, redirects to the created `scene-item`.\ + \ Once created, commit the scene via the updateScene API. For details, see\ + \ our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes)\ + \ guide." operationId: getQueuedSceneItem parameters: - description: The `queued-scene-item` ID. @@ -3899,7 +4596,8 @@ paths: - OAuth2: [] tags: - scene-items - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-scene-item-deletions/{id}: get: description: Get a `queued-scene-item-deletion` by ID. @@ -3958,7 +4656,8 @@ paths: - OAuth2: [] tags: - scene-items - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-views/{id}: delete: description: Delete a `scene-view`. @@ -4013,7 +4712,8 @@ paths: - OAuth2: [] tags: - scene-views - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `scene-view` by ID. operationId: getSceneView @@ -4071,7 +4771,8 @@ paths: - OAuth2: [] tags: - scene-views - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update a `scene-view`. operationId: updateSceneView @@ -4104,7 +4805,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -4146,12 +4847,13 @@ paths: - OAuth2: [] tags: - scene-views - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-views/{id}/image: get: - description: Get a rendered image of a `scene-view`. If a single pixel is returned, - ensure the `scene` is in the `commit` state and contains scene items. + description: "Get a rendered image of a `scene-view`. If a single pixel is returned,\ + \ ensure the `scene` is in the `commit` state and contains scene items." operationId: renderSceneView parameters: - description: The `scene-view` ID. @@ -4247,7 +4949,10 @@ paths: - OAuth2: [] tags: - scene-views - x-accepts: application/vnd.api+json,image/jpeg,image/png + x-accepts: + - application/vnd.api+json + - image/jpeg + - image/png /scene-views/{id}/scene-items/{itemId}: get: description: Get a `scene-item` within a view by ID. @@ -4269,15 +4974,15 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. `boundingBox`, `worldTransform` and `metadata` - are only returned if explicitly requested. + - description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. `boundingBox`, `worldTransform` and `metadata`\ + \ are only returned if explicitly requested." explode: true in: query - name: fields[scene-item] + name: "fields[scene-item]" required: false schema: - example: created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata + example: "created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata" type: string style: form - description: Comma-separated list of relationships to include in response. @@ -4335,7 +5040,8 @@ paths: - OAuth2: [] tags: - scene-views - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}/scene-views: get: description: Get `scene-view`s for a `scene`. @@ -4344,7 +5050,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -4353,7 +5059,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -4404,7 +5110,8 @@ paths: - OAuth2: [] tags: - scene-views - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: description: Create a `scene-view` of a `scene`. operationId: createSceneView @@ -4440,7 +5147,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -4482,8 +5189,9 @@ paths: - OAuth2: [] tags: - scene-views - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes: get: description: Get `scenes`. @@ -4492,7 +5200,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -4501,7 +5209,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -4513,20 +5221,20 @@ paths: - description: Comma-separated list of names to filter on. explode: true in: query - name: filter[name] + name: "filter[name]" required: false schema: - example: some-name-1,some-name-2 + example: "some-name-1,some-name-2" maxLength: 1024 type: string style: form - description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" maxLength: 1024 type: string style: form @@ -4534,24 +5242,57 @@ paths: value returns no fields. `metadata` is only returned if explicitly requested. explode: true in: query - name: fields[scene] + name: "fields[scene]" required: false schema: - example: camera,state,created,suppliedId,name,treeEnabled,modified,up,metadata + example: "camera,state,created,suppliedId,name,treeEnabled,modified,up,metadata" type: string style: form - description: | Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. explode: true in: query - name: filter[metadata] + name: "filter[metadata]" required: false schema: additionalProperties: type: string - example: filter[metadata][key1]=test + example: "filter[metadata][key1]=test" type: object style: form + - description: Comma-separated list of scene-item source part revision IDs to + filter on. + explode: true + in: query + name: "filter[sceneItems.source.partRevision]" + required: false + schema: + example: "?filter[sceneItems.source.partRevision]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" + maxLength: 1024 + type: string + style: form + - description: Comma-separated list of scene-item source geometry set IDs to + filter on. + explode: true + in: query + name: "filter[sceneItems.source.geometrySet]" + required: false + schema: + example: "?filter[sceneItems.source.geometrySet]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" + maxLength: 1024 + type: string + style: form + - description: Comma-separated list of scene-item source scene IDs to filter + on. + explode: true + in: query + name: "filter[sceneItems.source.scene]" + required: false + schema: + example: "?filter[sceneItems.source.scene]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" + maxLength: 1024 + type: string + style: form responses: "200": content: @@ -4586,11 +5327,12 @@ paths: - OAuth2: [] tags: - scenes - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: - description: Create a `scene`. Once created, add scene items via the createSceneItem - API. For details, see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) - guide. + description: "Create a `scene`. Once created, add scene items via the createSceneItem\ + \ API. For details, see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes)\ + \ guide." operationId: createScene requestBody: content: @@ -4615,7 +5357,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -4646,8 +5388,9 @@ paths: - OAuth2: [] tags: - scenes - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}: delete: description: Delete a `scene`. @@ -4702,7 +5445,8 @@ paths: - OAuth2: [] tags: - scenes - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `scene` by ID. operationId: getScene @@ -4720,10 +5464,10 @@ paths: if explicitly requested. explode: true in: query - name: fields[scene] + name: "fields[scene]" required: false schema: - example: camera,state,created,suppliedId,name,treeEnabled,modified,up,sceneItemCount,metadata + example: "camera,state,created,suppliedId,name,treeEnabled,modified,up,sceneItemCount,metadata" type: string style: form responses: @@ -4771,12 +5515,13 @@ paths: - OAuth2: [] tags: - scenes - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: - description: Update a `scene` camera and/or state. Once updated, view the scene - via the renderScene API or with the Viewer SDK. For details, see our [Render - static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) - guide. + description: "Update a `scene` camera and/or state. Once updated, view the scene\ + \ via the renderScene API or with the Viewer SDK. For details, see our [Render\ + \ static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes)\ + \ guide." operationId: updateScene parameters: - description: The `scene` ID. @@ -4807,7 +5552,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -4849,12 +5594,13 @@ paths: - OAuth2: [] tags: - scenes - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}/image: get: - description: Get a rendered image of a `scene`. If only a single pixel is returned, - ensure the `scene` is in the `commit` state and contains scene items. + description: "Get a rendered image of a `scene`. If only a single pixel is returned,\ + \ ensure the `scene` is in the `commit` state and contains scene items." operationId: renderScene parameters: - description: The `scene` ID. @@ -4950,7 +5696,10 @@ paths: - OAuth2: [] tags: - scenes - x-accepts: application/vnd.api+json,image/jpeg,image/png + x-accepts: + - application/vnd.api+json + - image/jpeg + - image/png /queued-scenes/{id}: get: description: Get a `queued-scene`. @@ -4965,14 +5714,249 @@ paths: $ref: '#/components/schemas/Uuid' style: simple responses: - "200": - content: - application/vnd.api+json: - schema: - $ref: '#/components/schemas/QueuedJob' - description: OK - "301": - description: Moved Permanently + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/QueuedJob' + description: OK + "301": + description: Moved Permanently + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - scenes + x-accepts: + - application/vnd.api+json + /scenes/{id}/scene-view-states: + get: + description: Get `scene-view-states` for a `scene`. + operationId: getSceneViewStates + parameters: + - description: The `scene` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + - description: The cursor for the next page of items. + explode: true + in: query + name: "page[cursor]" + required: false + schema: + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form + - description: Comma-separated list of fields to return in response. An empty + value returns no fields. `thumbnails` is only returned if explicitly requested. + explode: true + in: query + name: "fields[scene-view-state]" + required: false + schema: + example: thumbnails + type: string + style: form + - description: Comma-separated list of IDs to filter on. + explode: true + in: query + name: "filter[id]" + required: false + schema: + example: "some-id-1,some-id-2" + type: string + style: form + - description: Comma-separated list of supplied IDs to filter on. + explode: true + in: query + name: "filter[suppliedId]" + required: false + schema: + example: "some-id-1,some-id-2" + maxLength: 1024 + type: string + style: form + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/SceneViewStateList' + description: OK + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - scene-view-states + x-accepts: + - application/vnd.api+json + post: + description: Create a `scene-view-state` for a `scene`. + operationId: createSceneViewState + parameters: + - description: The `scene` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/CreateSceneViewStateRequest' + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/SceneViewState' + description: Created + headers: + location: + $ref: '#/components/headers/Location' + "400": + content: + application/vnd.api+json: + example: + errors: + - status: "400" + code: BadRequest + title: "Invalid, missing, or out-of-range request parameters." + schema: + $ref: '#/components/schemas/Failure' + description: Bad Request + "401": + content: + application/vnd.api+json: + example: + errors: + - status: "401" + code: Unauthorized + title: Invalid or missing credentials. + schema: + $ref: '#/components/schemas/Failure' + description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + "415": + content: + application/vnd.api+json: + example: + errors: + - status: "415" + code: UnsupportedMediaType + title: The provided media type is not supported. Update the Content-Type + header to application/vnd.api+json and try again. + schema: + $ref: '#/components/schemas/Failure' + description: Unsupported Media Type + security: + - OAuth2: [] + tags: + - scene-view-states + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scene-view-states/{id}: + delete: + description: Delete a `scene-view-state`. + operationId: deleteSceneViewState + parameters: + - description: The `scene-view-state` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + responses: + "204": + description: No Content "401": content: application/vnd.api+json: @@ -5010,14 +5994,14 @@ paths: security: - OAuth2: [] tags: - - scenes - x-accepts: application/vnd.api+json - /scenes/{id}/scene-view-states: + - scene-view-states + x-accepts: + - application/vnd.api+json get: - description: Get `scene-view-states` for a `scene`. - operationId: getSceneViewStates + description: Get a `scene-view-state` by ID. + operationId: getSceneViewState parameters: - - description: The `scene` ID. + - description: The `scene-view-state` ID. explode: false in: path name: id @@ -5025,62 +6009,22 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: The cursor for the next page of items. - explode: true - in: query - name: page[cursor] - required: false - schema: - example: cHJkMDVFR2RLag== - type: string - style: form - - description: The number of items to return. - explode: true - in: query - name: page[size] - required: false - schema: - example: 10 - format: int32 - maximum: 200 - minimum: 1 - type: integer - style: form - description: Comma-separated list of fields to return in response. An empty value returns no fields. `thumbnails` is only returned if explicitly requested. explode: true in: query - name: fields[scene-view-state] + name: "fields[scene-view-state]" required: false schema: example: thumbnails type: string style: form - - description: Comma-separated list of IDs to filter on. - explode: true - in: query - name: filter[id] - required: false - schema: - example: some-id-1,some-id-2 - type: string - style: form - - description: Comma-separated list of supplied IDs to filter on. - explode: true - in: query - name: filter[suppliedId] - required: false - schema: - example: some-id-1,some-id-2 - maxLength: 1024 - type: string - style: form responses: "200": content: application/vnd.api+json: schema: - $ref: '#/components/schemas/SceneViewStateList' + $ref: '#/components/schemas/SceneViewState' description: OK "401": content: @@ -5093,6 +6037,17 @@ paths: schema: $ref: '#/components/schemas/Failure' description: Unauthorized + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found "415": content: application/vnd.api+json: @@ -5109,12 +6064,13 @@ paths: - OAuth2: [] tags: - scene-view-states - x-accepts: application/vnd.api+json - post: - description: Create a `scene-view-state` for a `scene`. - operationId: createSceneViewState + x-accepts: + - application/vnd.api+json + patch: + description: Update a `scene-view-state`. + operationId: updateSceneViewState parameters: - - description: The `scene` ID. + - description: The `scene-view-state` ID. explode: false in: path name: id @@ -5126,18 +6082,15 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/CreateSceneViewStateRequest' + $ref: '#/components/schemas/UpdateSceneViewStateRequest' required: true responses: - "201": + "200": content: application/vnd.api+json: schema: $ref: '#/components/schemas/SceneViewState' - description: Created - headers: - location: - $ref: '#/components/headers/Location' + description: OK "400": content: application/vnd.api+json: @@ -5145,7 +6098,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -5187,14 +6140,15 @@ paths: - OAuth2: [] tags: - scene-view-states - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json - /scene-view-states/{id}: - delete: - description: Delete a `scene-view-state`. - operationId: deleteSceneViewState + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scenes/{id}/stream-keys: + post: + description: Create a `stream-key` for a `scene`. + operationId: createSceneStreamKey parameters: - - description: The `scene-view-state` ID. + - description: The `scene` ID. explode: false in: path name: id @@ -5202,9 +6156,22 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/CreateStreamKeyRequest' + required: true responses: - "204": - description: No Content + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/StreamKey' + description: Created + headers: + location: + $ref: '#/components/headers/Location' "401": content: application/vnd.api+json: @@ -5242,13 +6209,16 @@ paths: security: - OAuth2: [] tags: - - scene-view-states - x-accepts: application/vnd.api+json + - stream-keys + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scenes/{id}/scene-annotation-sets: get: - description: Get a `scene-view-state` by ID. - operationId: getSceneViewState + description: Get `scene-annotation-sets` for a `scene`. + operationId: getSceneAnnotationSets parameters: - - description: The `scene-view-state` ID. + - description: The `scene` ID. explode: false in: path name: id @@ -5256,14 +6226,44 @@ paths: schema: $ref: '#/components/schemas/Uuid' style: simple - - description: Comma-separated list of fields to return in response. An empty - value returns no fields. `thumbnails` is only returned if explicitly requested. + - description: The cursor for the next page of items. explode: true in: query - name: fields[scene-view-state] + name: "page[cursor]" required: false schema: - example: thumbnails + example: cHJkMDVFR2RLag== + type: string + style: form + - description: The number of items to return. + explode: true + in: query + name: "page[size]" + required: false + schema: + example: 10 + format: int32 + maximum: 200 + minimum: 1 + type: integer + style: form + - description: Comma-separated list of IDs to filter on. + explode: true + in: query + name: "filter[id]" + required: false + schema: + example: "some-id-1,some-id-2" + type: string + style: form + - description: Comma-separated list of supplied IDs to filter on. + explode: true + in: query + name: "filter[suppliedId]" + required: false + schema: + example: "some-id-1,some-id-2" + maxLength: 1024 type: string style: form responses: @@ -5271,7 +6271,7 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/SceneViewState' + $ref: '#/components/schemas/SceneAnnotationSetList' description: OK "401": content: @@ -5310,13 +6310,16 @@ paths: security: - OAuth2: [] tags: - - scene-view-states - x-accepts: application/vnd.api+json - patch: - description: Update a `scene-view-state`. - operationId: updateSceneViewState + - scene-annotations + x-accepts: + - application/vnd.api+json + post: + description: | + Create an annotation set that is associated with a scene. + **Preview:** This is a preview API and is subject to change. + operationId: createSceneAnnotationSet parameters: - - description: The `scene-view-state` ID. + - description: The `scene` ID. explode: false in: path name: id @@ -5328,26 +6331,103 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/UpdateSceneViewStateRequest' + $ref: '#/components/schemas/CreateSceneAnnotationSetRequest' required: true responses: - "200": + "201": content: application/vnd.api+json: schema: - $ref: '#/components/schemas/SceneViewState' - description: OK - "400": + $ref: '#/components/schemas/SceneAnnotationSet' + description: Created + headers: + location: + $ref: '#/components/headers/Location' + "404": content: application/vnd.api+json: example: errors: - - status: "400" - code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + - status: "404" + code: NotFound + title: The requested resource was not found. schema: $ref: '#/components/schemas/Failure' - description: Bad Request + description: Not Found + security: + - OAuth2: [] + tags: + - scene-annotations + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scene-annotation-sets/{id}/scene-annotations: + post: + description: | + Create an annotation belonging to an annotation set. + **Preview:** This is a preview API and is subject to change. + operationId: createSceneAnnotation + parameters: + - description: The `scene-annotation-set` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/CreateSceneAnnotationRequest' + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/SceneAnnotation' + description: Created + headers: + location: + $ref: '#/components/headers/Location' + "404": + content: + application/vnd.api+json: + example: + errors: + - status: "404" + code: NotFound + title: The requested resource was not found. + schema: + $ref: '#/components/schemas/Failure' + description: Not Found + security: + - OAuth2: [] + tags: + - scene-annotations + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json + /scene-annotations/{id}: + delete: + description: | + Delete a scene annotation. + **Preview:** This is a preview API and is subject to change. + operationId: deleteSceneAnnotation + parameters: + - description: The `scene-annotation` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + responses: + "204": + description: No Content "401": content: application/vnd.api+json: @@ -5385,15 +6465,16 @@ paths: security: - OAuth2: [] tags: - - scene-view-states - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json - /scenes/{id}/stream-keys: - post: - description: Create a `stream-key` for a `scene`. - operationId: createSceneStreamKey + - scene-annotations + x-accepts: + - application/vnd.api+json + patch: + description: | + Update the attributes of an annotation. + **Preview:** This is a preview API and is subject to change. + operationId: updateSceneAnnotation parameters: - - description: The `scene` ID. + - description: The `scene-annotation` ID. explode: false in: path name: id @@ -5405,29 +6486,15 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/CreateStreamKeyRequest' + $ref: '#/components/schemas/UpdateSceneAnnotationRequest' required: true - responses: - "201": - content: - application/vnd.api+json: - schema: - $ref: '#/components/schemas/StreamKey' - description: Created - headers: - location: - $ref: '#/components/headers/Location' - "401": - content: - application/vnd.api+json: - example: - errors: - - status: "401" - code: Unauthorized - title: Invalid or missing credentials. + responses: + "200": + content: + application/vnd.api+json: schema: - $ref: '#/components/schemas/Failure' - description: Unauthorized + $ref: '#/components/schemas/SceneAnnotation' + description: OK "404": content: application/vnd.api+json: @@ -5439,24 +6506,13 @@ paths: schema: $ref: '#/components/schemas/Failure' description: Not Found - "415": - content: - application/vnd.api+json: - example: - errors: - - status: "415" - code: UnsupportedMediaType - title: The provided media type is not supported. Update the Content-Type - header to application/vnd.api+json and try again. - schema: - $ref: '#/components/schemas/Failure' - description: Unsupported Media Type security: - OAuth2: [] tags: - - stream-keys - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + - scene-annotations + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scenes/{id}/scene-syncs: post: description: Create a scene item update job. @@ -5501,8 +6557,9 @@ paths: - OAuth2: [] tags: - scene-synchronizations - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-scene-syncs/{id}: get: description: Get a `queued-scene-sync-job`. @@ -5561,7 +6618,8 @@ paths: - OAuth2: [] tags: - scene-synchronizations - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-syncs/{id}: get: description: Get a `scene-sync`. @@ -5620,7 +6678,8 @@ paths: - OAuth2: [] tags: - scene-synchronizations - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /scene-syncs/{id}/item-results: get: description: Get the results of a scene synchronization. @@ -5637,7 +6696,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -5646,7 +6705,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -5658,7 +6717,7 @@ paths: - description: List of scene item IDs to filter on. explode: true in: query - name: filter[sceneItemId] + name: "filter[sceneItemId]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 @@ -5711,7 +6770,8 @@ paths: - OAuth2: [] tags: - scene-synchronizations - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /stream-keys: get: description: Get `stream-key`s. @@ -5720,7 +6780,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -5729,7 +6789,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -5741,7 +6801,7 @@ paths: - description: Stream key to filter on. explode: true in: query - name: filter[key] + name: "filter[key]" required: false schema: example: i3MFRDOmg1pxD36dGCTONRwOujkgV8m9LQ @@ -5781,7 +6841,8 @@ paths: - OAuth2: [] tags: - stream-keys - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /stream-keys/{id}: delete: description: Delete a `stream-key`. @@ -5836,7 +6897,8 @@ paths: - OAuth2: [] tags: - stream-keys - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /translation-inspections: post: description: Create a `translation-inspection`. @@ -5864,7 +6926,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -5895,8 +6957,9 @@ paths: - OAuth2: [] tags: - translation-inspections - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /translation-inspections/{id}: get: description: Get a `translation-inspection` by ID. @@ -5955,7 +7018,8 @@ paths: - OAuth2: [] tags: - translation-inspections - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-translation-jobs: get: description: Get all current translation jobs in progress. @@ -5964,7 +7028,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -5973,7 +7037,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -5982,16 +7046,34 @@ paths: minimum: 1 type: integer style: form + - description: A sort to apply to the collection. A "minus" prefixed before + the field name is used to specify descending sort order. + explode: true + in: query + name: sort + required: false + schema: + example: "-age,name" + type: string + style: form - description: Status to filter on. explode: true in: query - name: filter[status] + name: "filter[status]" required: false schema: - example: running + example: "running,complete" maxLength: 1024 type: string style: form + - description: The completion date and time to filter on. + explode: true + in: query + name: "filter[completedAt]" + required: false + schema: + $ref: '#/components/schemas/FilterExpression' + style: form responses: "200": content: @@ -6037,14 +7119,15 @@ paths: - OAuth2: [] tags: - translation-inspections - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-translation-jobs/{id}: get: - description: Get a `queued-translation-job`. The response is either the status - if `running` or `error` or, upon completion, the `part-revision` that was - created. Once created, create scenes via the createScene API. For details, - see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) - guide. + description: "Get a `queued-translation-job`. The response is either the status\ + \ if `running` or `error` or, upon completion, the `part-revision` that was\ + \ created. Once created, create scenes via the createScene API. For details,\ + \ see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes)\ + \ guide." operationId: getQueuedTranslationJob parameters: - description: The `queued-translation` ID. @@ -6102,7 +7185,8 @@ paths: - OAuth2: [] tags: - translation-inspections - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-translations: get: deprecated: true @@ -6113,7 +7197,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -6122,7 +7206,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -6134,10 +7218,10 @@ paths: - description: Status to filter on. explode: true in: query - name: filter[status] + name: "filter[status]" required: false schema: - example: running + example: "running,complete" maxLength: 1024 type: string style: form @@ -6188,16 +7272,17 @@ paths: - OAuth2: [] tags: - translation-inspections - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-translations/{id}: get: deprecated: true - description: This has been deprecated and replaced by **queued-translation-jobs/{id}** - - Get a `queued-translation`. The response is either the status if `running` - or `error` or, upon completion, redirects to the created `part-revision`. - Once created, create scenes via the createScene API. For details, see our - [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) - guide. + description: "This has been deprecated and replaced by **queued-translation-jobs/{id}**\ + \ - Get a `queued-translation`. The response is either the status if `running`\ + \ or `error` or, upon completion, redirects to the created `part-revision`.\ + \ Once created, create scenes via the createScene API. For details, see our\ + \ [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes)\ + \ guide." operationId: getQueuedTranslation parameters: - description: The `queued-translation` ID. @@ -6255,11 +7340,12 @@ paths: - OAuth2: [] tags: - translation-inspections - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /exports: post: - description: Create an `export`. This API is asynchronous, returning the location - of a `queued-export`. Check the status via the getQueuedExport API. + description: "Create an `export`. This API is asynchronous, returning the location\ + \ of a `queued-export`. Check the status via the getQueuedExport API." operationId: createExport requestBody: content: @@ -6284,7 +7370,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -6315,8 +7401,9 @@ paths: - OAuth2: [] tags: - exports - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /exports/{id}: get: description: Get an `export` by ID. @@ -6375,11 +7462,12 @@ paths: - OAuth2: [] tags: - exports - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /queued-exports/{id}: get: - description: Get a `queued-export`. The response is either the status if `running` - or `error` or, upon completion, redirects to the created `export`. + description: "Get a `queued-export`. The response is either the status if `running`\ + \ or `error` or, upon completion, redirects to the created `export`." operationId: getQueuedExport parameters: - description: The `queued-export` ID. @@ -6437,7 +7525,8 @@ paths: - OAuth2: [] tags: - exports - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json /webhook-subscriptions: get: description: Get `webhook-subscription`s. @@ -6446,7 +7535,7 @@ paths: - description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -6455,7 +7544,7 @@ paths: - description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -6498,7 +7587,8 @@ paths: - OAuth2: [] tags: - webhook-subscriptions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json post: callbacks: queued-export.completed: @@ -6624,8 +7714,9 @@ paths: - OAuth2: [] tags: - webhook-subscriptions - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json /webhook-subscriptions/{id}: delete: description: Delete a `webhook-subscription`. @@ -6680,7 +7771,8 @@ paths: - OAuth2: [] tags: - webhook-subscriptions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json get: description: Get a `webhook-subscription`. operationId: getWebhookSubscription @@ -6738,7 +7830,8 @@ paths: - OAuth2: [] tags: - webhook-subscriptions - x-accepts: application/vnd.api+json + x-accepts: + - application/vnd.api+json patch: description: Update a `webhook-subscription`. operationId: updateWebhookSubscription @@ -6771,7 +7864,7 @@ paths: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -6813,8 +7906,9 @@ paths: - OAuth2: [] tags: - webhook-subscriptions - x-contentType: application/vnd.api+json - x-accepts: application/vnd.api+json + x-content-type: application/vnd.api+json + x-accepts: + - application/vnd.api+json components: headers: Location: @@ -6854,7 +7948,7 @@ components: description: A perspective camera that mimics the way the human eye sees. explode: true in: query - name: camera[perspective] + name: "camera[perspective]" required: false schema: $ref: '#/components/schemas/PerspectiveCamera' @@ -6863,7 +7957,7 @@ components: description: The perspective camera position. explode: true in: query - name: camera[perspective][position] + name: "camera[perspective][position]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6872,7 +7966,7 @@ components: description: The perspective camera look at position. explode: true in: query - name: camera[perspective][lookAt] + name: "camera[perspective][lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6881,7 +7975,7 @@ components: description: The perspective camera up vector. explode: true in: query - name: camera[perspective][up] + name: "camera[perspective][up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6890,7 +7984,7 @@ components: description: The orthographic camera view vector. explode: true in: query - name: camera[orthographic][viewVector] + name: "camera[orthographic][viewVector]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6899,7 +7993,7 @@ components: description: The orthographic camera look at position. explode: true in: query - name: camera[orthographic][lookAt] + name: "camera[orthographic][lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6908,7 +8002,7 @@ components: description: The orthographic camera up vector. explode: true in: query - name: camera[orthographic][up] + name: "camera[orthographic][up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6917,7 +8011,7 @@ components: description: The orthographic field-of-view height. explode: true in: query - name: camera[orthographic][fovHeight] + name: "camera[orthographic][fovHeight]" required: false schema: exclusiveMinimum: true @@ -6928,7 +8022,7 @@ components: description: The `camera` up vector. explode: true in: query - name: camera[up] + name: "camera[up]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6937,7 +8031,7 @@ components: description: The `camera` position vector. explode: true in: query - name: camera[position] + name: "camera[position]" required: false schema: $ref: '#/components/schemas/Vector3' @@ -6946,11 +8040,20 @@ components: description: The `camera` lookAt vector. explode: true in: query - name: camera[lookAt] + name: "camera[lookAt]" required: false schema: $ref: '#/components/schemas/Vector3' style: deepObject + CompletedAtFilter: + description: The completion date and time to filter on. + explode: true + in: query + name: "filter[completedAt]" + required: false + schema: + $ref: '#/components/schemas/FilterExpression' + style: form ExportId: description: The `export` ID. explode: false @@ -6969,6 +8072,17 @@ components: schema: $ref: '#/components/schemas/Uuid' style: simple + HasAnnotationsFilter: + description: Filter model views that contain or do not contain annotations. + explode: true + in: query + name: "filter[hasAnnotations]" + required: false + schema: + example: true + maxLength: 1024 + type: boolean + style: form Height: description: The height of the image to render. explode: true @@ -6986,10 +8100,10 @@ components: description: Comma-separated list of IDs to filter on. explode: true in: query - name: filter[id] + name: "filter[id]" required: false schema: - example: some-id-1,some-id-2 + example: "some-id-1,some-id-2" type: string style: form IncludeSource: @@ -7025,14 +8139,23 @@ components: maxLength: 32 type: string style: form + ModelViewIdFilter: + description: Filter annotations belonging to a model view. + explode: true + in: query + name: "filter[modelViewId]" + required: false + schema: + $ref: '#/components/schemas/Uuid' + style: form NameFilter: description: Comma-separated list of names to filter on. explode: true in: query - name: filter[name] + name: "filter[name]" required: false schema: - example: some-name-1,some-name-2 + example: "some-name-1,some-name-2" maxLength: 1024 type: string style: form @@ -7040,7 +8163,7 @@ components: description: The cursor for the next page of items. explode: true in: query - name: page[cursor] + name: "page[cursor]" required: false schema: example: cHJkMDVFR2RLag== @@ -7050,7 +8173,7 @@ components: description: The number of items to return. explode: true in: query - name: page[size] + name: "page[size]" required: false schema: example: 10 @@ -7069,15 +8192,15 @@ components: $ref: '#/components/schemas/Uuid' style: simple PartRevisionFields: - description: Comma-separated list of fields to return in response. An empty - value returns no fields. Due to its potential size, metadata is only returned - if explicitly requested. + description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. Due to its potential size, metadata is only returned\ + \ if explicitly requested." explode: true in: query - name: fields[part-revision] + name: "fields[part-revision]" required: false schema: - example: created,suppliedId,metadata + example: "created,suppliedId,metadata" maxLength: 32 type: string style: form @@ -7108,16 +8231,34 @@ components: schema: $ref: '#/components/schemas/Uuid' style: simple + SceneAnnotationSetId: + description: The `scene-annotation-set` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple + SceneAnnotationId: + description: The `scene-annotation` ID. + explode: false + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/Uuid' + style: simple SceneFields: description: Comma-separated list of fields to return in response. An empty value returns no fields. `sceneItemCount` and `metadata` are only returned if explicitly requested. explode: true in: query - name: fields[scene] + name: "fields[scene]" required: false schema: - example: camera,state,created,suppliedId,name,treeEnabled,modified,up,sceneItemCount,metadata + example: "camera,state,created,suppliedId,name,treeEnabled,modified,up,sceneItemCount,metadata" type: string style: form ListScenesFields: @@ -7125,10 +8266,10 @@ components: value returns no fields. `metadata` is only returned if explicitly requested. explode: true in: query - name: fields[scene] + name: "fields[scene]" required: false schema: - example: camera,state,created,suppliedId,name,treeEnabled,modified,up,metadata + example: "camera,state,created,suppliedId,name,treeEnabled,modified,up,metadata" type: string style: form MetadataFilter: @@ -7136,12 +8277,12 @@ components: Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. explode: true in: query - name: filter[metadata] + name: "filter[metadata]" required: false schema: additionalProperties: type: string - example: filter[metadata][key1]=test + example: "filter[metadata][key1]=test" type: object style: form QueuedSceneSyncId: @@ -7157,7 +8298,7 @@ components: description: A revision ID to filter on. explode: true in: query - name: filter[revisionId] + name: "filter[revisionId]" required: false schema: $ref: '#/components/schemas/Uuid' @@ -7167,7 +8308,7 @@ components: value returns no fields. `thumbnails` is only returned if explicitly requested. explode: true in: query - name: fields[scene-view-state] + name: "fields[scene-view-state]" required: false schema: example: thumbnails @@ -7183,15 +8324,15 @@ components: $ref: '#/components/schemas/Uuid' style: simple SceneItemFields: - description: Comma-separated list of fields to return in response. An empty - value returns no fields. `boundingBox`, `worldTransform` and `metadata` are - only returned if explicitly requested. + description: "Comma-separated list of fields to return in response. An empty\ + \ value returns no fields. `boundingBox`, `worldTransform` and `metadata`\ + \ are only returned if explicitly requested." explode: true in: query - name: fields[scene-item] + name: "fields[scene-item]" required: false schema: - example: created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata + example: "created,suppliedId,visible,transform,worldTransform,materialOverride,boundingBox,metadata" type: string style: form SceneItemOverrideId: @@ -7240,24 +8381,26 @@ components: $ref: '#/components/schemas/Uuid' style: simple SourceFilter: + allowEmptyValue: true description: Source ID to filter on. explode: true in: query - name: filter[source] + name: "filter[source]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 maxLength: 1024 + nullable: true type: string style: form StatusFilter: description: Status to filter on. explode: true in: query - name: filter[status] + name: "filter[status]" required: false schema: - example: running + example: "running,complete" maxLength: 1024 type: string style: form @@ -7265,7 +8408,19 @@ components: description: List of scene item IDs to filter on. explode: true in: query - name: filter[sceneItemId] + name: "filter[sceneItemId]" + required: false + schema: + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + style: form + PropertyEntriesResourceIdFilter: + description: A resource ID to filter on + explode: true + in: query + name: "filter[resourceId]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 @@ -7273,25 +8428,96 @@ components: maxLength: 36 type: string style: form + PropertyEntriesResourceTypeFilter: + description: The provided type for the resource ids + explode: true + in: query + name: "filter[resourceType]" + required: false + schema: + example: part-revision + maxLength: 36 + type: string + style: form + PropertyEntriesCategoryFilter: + description: The key categories to filter by + explode: true + in: query + name: "filter[key.category]" + required: false + schema: + description: The key category + enum: + - vendor + - vertex + - user + type: string + style: form SuppliedIdFilter: description: Comma-separated list of supplied IDs to filter on. explode: true in: query - name: filter[suppliedId] + name: "filter[suppliedId]" + required: false + schema: + example: "some-id-1,some-id-2" + maxLength: 1024 + type: string + style: form + SceneItemsPartRevisionSourceFilter: + description: Comma-separated list of scene-item source part revision IDs to + filter on. + explode: true + in: query + name: "filter[sceneItems.source.partRevision]" required: false schema: - example: some-id-1,some-id-2 + example: "?filter[sceneItems.source.partRevision]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" maxLength: 1024 type: string style: form + SceneItemsGeometrySetSourceFilter: + description: Comma-separated list of scene-item source geometry set IDs to filter + on. + explode: true + in: query + name: "filter[sceneItems.source.geometrySet]" + required: false + schema: + example: "?filter[sceneItems.source.geometrySet]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" + maxLength: 1024 + type: string + style: form + SceneItemsSceneSourceFilter: + description: Comma-separated list of scene-item source scene IDs to filter on. + explode: true + in: query + name: "filter[sceneItems.source.scene]" + required: false + schema: + example: "?filter[sceneItems.source.scene]=f79d4760-0b71-44e4-ad0b-22743fdd4ca3,f79d4760-0b71-44e4-ad0b-22743fdd4ca2" + maxLength: 1024 + type: string + style: form + Sort: + description: A sort to apply to the collection. A "minus" prefixed before the + field name is used to specify descending sort order. + explode: true + in: query + name: sort + required: false + schema: + example: "-age,name" + type: string + style: form ClientIdFilter: description: Comma-separated list of client IDs to filter on. explode: true in: query - name: filter[clientId] + name: "filter[clientId]" required: false schema: - example: ?filter[clientId]=some-id-1&filter[clientId]=some-id-2 + example: "?filter[clientId]=some-id-1&filter[clientId]=some-id-2" maxLength: 1024 type: string style: form @@ -7299,7 +8525,7 @@ components: description: Parent ID to filter on. explode: true in: query - name: filter[parent] + name: "filter[parent]" required: false schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 @@ -7311,7 +8537,7 @@ components: description: Stream key to filter on. explode: true in: query - name: filter[key] + name: "filter[key]" required: false schema: example: i3MFRDOmg1pxD36dGCTONRwOujkgV8m9LQ @@ -7360,7 +8586,7 @@ components: errors: - status: "400" code: BadRequest - title: Invalid, missing, or out-of-range request parameters. + title: "Invalid, missing, or out-of-range request parameters." schema: $ref: '#/components/schemas/Failure' description: Bad Request @@ -7564,9 +8790,7 @@ components: vertexvis/batch:results: description: List of operation results. items: - anyOf: - - $ref: '#/components/schemas/RelationshipData' - - $ref: '#/components/schemas/ApiError' + $ref: '#/components/schemas/Batch_vertexvis_batch_results_inner' type: array required: - vertexvis/batch:results @@ -7606,6 +8830,14 @@ components: required: - data type: object + UpdateFileRequest: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/UpdateFileRequest_data' + required: + - data + type: object GeometrySetList: additionalProperties: false properties: @@ -7656,10 +8888,7 @@ components: $ref: '#/components/schemas/Hit_data' included: items: - oneOf: - - $ref: '#/components/schemas/HitResultData' - - $ref: '#/components/schemas/SceneItemData' - - $ref: '#/components/schemas/PartRevisionData' + $ref: '#/components/schemas/Hit_included_inner' type: array links: additionalProperties: @@ -7827,7 +9056,7 @@ components: description: x-axis coordinate. example: 1.0 type: number - y: + "y": description: y-axis coordinate. example: 0.0 type: number @@ -7840,6 +9069,21 @@ components: - "y" - z type: object + PartRevisionInstanceList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/PartRevisionInstanceData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object PartRevisionList: additionalProperties: false properties: @@ -7894,6 +9138,71 @@ components: required: - data type: object + ModelView: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/ModelViewData' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + type: object + ModelViewList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/ModelViewData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object + PmiAnnotationList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/PmiAnnotationData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object + PropertyEntryList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/PropertyEntryData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object + UpsertPropertyEntriesRequest: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data' + required: + - data + type: object SceneAlteration: additionalProperties: false properties: @@ -8070,59 +9379,122 @@ components: additionalProperties: false properties: data: - $ref: '#/components/schemas/CreateSceneViewRequest_data' + $ref: '#/components/schemas/CreateSceneViewRequest_data' + required: + - data + type: object + SceneList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/SceneData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object + CreateSceneRequest: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/CreateSceneRequest_data' + required: + - data + type: object + Scene: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/SceneData' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + type: object + UpdateSceneRequest: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/UpdateSceneRequest_data' + required: + - data + type: object + SceneViewStateList: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/SceneViewStateData' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + - links + type: object + CreateSceneViewStateRequest: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/CreateSceneViewStateRequest_data' required: - data type: object - SceneList: + SceneViewState: additionalProperties: false properties: data: - items: - $ref: '#/components/schemas/SceneData' - type: array + $ref: '#/components/schemas/SceneViewStateData' links: additionalProperties: $ref: '#/components/schemas/Link' type: object required: - data - - links type: object - CreateSceneRequest: + UpdateSceneViewStateRequest: additionalProperties: false properties: data: - $ref: '#/components/schemas/CreateSceneRequest_data' + $ref: '#/components/schemas/UpdateSceneViewStateRequest_data' required: - data type: object - Scene: + CreateStreamKeyRequest: additionalProperties: false properties: data: - $ref: '#/components/schemas/SceneData' - links: - additionalProperties: - $ref: '#/components/schemas/Link' - type: object + $ref: '#/components/schemas/CreateStreamKeyRequest_data' required: - data type: object - UpdateSceneRequest: + StreamKey: additionalProperties: false properties: data: - $ref: '#/components/schemas/UpdateSceneRequest_data' + $ref: '#/components/schemas/StreamKeyData' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object required: - data type: object - SceneViewStateList: + SceneAnnotationSetList: additionalProperties: false properties: data: items: - $ref: '#/components/schemas/SceneViewStateData' + $ref: '#/components/schemas/SceneAnnotationSetData' type: array links: additionalProperties: @@ -8132,19 +9504,19 @@ components: - data - links type: object - CreateSceneViewStateRequest: + CreateSceneAnnotationSetRequest: additionalProperties: false properties: data: - $ref: '#/components/schemas/CreateSceneViewStateRequest_data' + $ref: '#/components/schemas/CreateSceneAnnotationSetRequest_data' required: - data type: object - SceneViewState: + SceneAnnotationSet: additionalProperties: false properties: data: - $ref: '#/components/schemas/SceneViewStateData' + $ref: '#/components/schemas/SceneAnnotationSetData' links: additionalProperties: $ref: '#/components/schemas/Link' @@ -8152,31 +9524,31 @@ components: required: - data type: object - UpdateSceneViewStateRequest: + CreateSceneAnnotationRequest: additionalProperties: false properties: data: - $ref: '#/components/schemas/UpdateSceneViewStateRequest_data' + $ref: '#/components/schemas/CreateSceneAnnotationRequest_data' required: - data type: object - CreateStreamKeyRequest: + SceneAnnotation: additionalProperties: false properties: data: - $ref: '#/components/schemas/CreateStreamKeyRequest_data' + $ref: '#/components/schemas/SceneAnnotationData' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object required: - data type: object - StreamKey: + UpdateSceneAnnotationRequest: additionalProperties: false properties: data: - $ref: '#/components/schemas/StreamKeyData' - links: - additionalProperties: - $ref: '#/components/schemas/Link' - type: object + $ref: '#/components/schemas/UpdateSceneAnnotationRequest_data' required: - data type: object @@ -8184,16 +9556,10 @@ components: additionalProperties: false description: An operation to perform on a Scene. properties: - operations: - description: List of operations to perform on `scene-items` in the scene. - items: - oneOf: - - $ref: '#/components/schemas/UpdateItemToDefaultRenditionOperation' - maxItems: 1024 - minItems: 1 - type: array + operation: + $ref: '#/components/schemas/CreateSceneSyncRequest_operation' required: - - operations + - operation type: object SceneSync: additionalProperties: false @@ -8262,6 +9628,29 @@ components: required: - data type: object + FilterExpression: + additionalProperties: false + description: Describes how an attribute should be filtered. + properties: + eq: + description: A value of a filter. + type: string + neq: + description: A value of a filter. + type: string + gt: + description: A value of a filter. + type: string + gte: + description: A value of a filter. + type: string + lt: + description: A value of a filter. + type: string + lte: + description: A value of a filter. + type: string + type: object QueuedJobList: additionalProperties: false properties: @@ -8284,10 +9673,7 @@ components: $ref: '#/components/schemas/QueuedTranslationJobData' included: items: - anyOf: - - $ref: '#/components/schemas/GeometrySetData' - - $ref: '#/components/schemas/PartRevisionData' - - $ref: '#/components/schemas/PartRenditionData' + $ref: '#/components/schemas/QueuedTranslationJob_included_inner' type: array links: additionalProperties: @@ -8371,6 +9757,9 @@ components: attributes: created: 2020-01-01T12:00:00Z topic: some-string + changed: + - some-string + - some-string links: key: href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 @@ -8387,14 +9776,7 @@ components: $ref: '#/components/schemas/WebhookEventData' included: items: - discriminator: - mapping: - scene: '#/components/schemas/WebhookEventSceneIncludedData' - part-revision: '#/components/schemas/WebhookEventPartRevisionIncludedData' - propertyName: type - oneOf: - - $ref: '#/components/schemas/WebhookEventSceneIncludedData' - - $ref: '#/components/schemas/WebhookEventPartRevisionIncludedData' + $ref: '#/components/schemas/WebhookEvent_included_inner' type: array links: additionalProperties: @@ -8418,15 +9800,15 @@ components: type: perspective position: x: 0.0 - y: 0.0 + "y": 0.0 z: -100.0 lookAt: x: 0.0 - y: 0.0 + "y": 0.0 z: 0.0 up: x: 0.0 - y: 1.0 + "y": 1.0 z: 0.0 fovY: 45.0 properties: @@ -8483,7 +9865,7 @@ components: example: A validation error occurred. type: string detail: - example: '$.data.attributes.suppliedId: is missing but it is required' + example: "$.data.attributes.suppliedId: is missing but it is required" type: string source: $ref: '#/components/schemas/ApiError_source' @@ -8523,9 +9905,7 @@ components: additionalProperties: false properties: data: - anyOf: - - $ref: '#/components/schemas/CreateSceneItemRequestData' - description: Operation's primary data. + $ref: '#/components/schemas/CreateSceneItemRequestData' op: description: Batch operation type type. enum: @@ -8789,93 +10169,296 @@ components: - type - value type: object - MetadataFloatType: + MetadataFloatType: + properties: + type: + description: Type of metadata value. + example: float + maxLength: 32 + type: string + value: + description: A numerical floating-point value. + format: float + type: number + required: + - type + - value + type: object + MetadataDateType: + properties: + type: + description: Type of metadata value. + example: date + maxLength: 32 + type: string + value: + description: A date value. + example: 2022-02-22T10:11:12Z + format: date-time + type: string + required: + - type + - value + type: object + MetadataStringType: + properties: + type: + description: Type of metadata value. + example: string + maxLength: 32 + type: string + value: + description: A string value. + example: Some value + type: string + required: + - type + - value + type: object + MetadataNullType: + properties: + type: + description: Type of metadata value. + example: "null" + maxLength: 32 + type: string + required: + - type + type: object + PartRenditionRelationship: + additionalProperties: false + description: Relationship to a `part-rendition`. + properties: + data: + $ref: '#/components/schemas/PartRenditionRelationship_data' + required: + - data + type: object + PartRevisionInstanceData: + additionalProperties: false + properties: + type: + example: part-revision-instance + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/PartRevisionInstanceData_attributes' + relationships: + $ref: '#/components/schemas/PartRevisionInstanceData_relationships' + required: + - attributes + - id + - relationships + - type + type: object + PartData: + additionalProperties: false + properties: + type: + example: part + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/PartData_attributes' + relationships: + $ref: '#/components/schemas/PartData_relationships' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - type + type: object + PartAssemblyRelationship: + additionalProperties: false + description: Create Part Assembly + properties: + data: + $ref: '#/components/schemas/PartAssemblyRelationship_data' + required: + - data + type: object + ModelViewData: + additionalProperties: false + properties: + type: + example: model-view + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/CreateAccountRequest_data_attributes' + relationships: + $ref: '#/components/schemas/ModelViewData_relationships' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - relationships + - type + type: object + PmiAnnotationData: + additionalProperties: false + properties: + type: + example: pmi-annotation + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/CreateAccountRequest_data_attributes' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - type + type: object + PropertyEntryData: + additionalProperties: false + properties: + type: + example: property-entry + type: string + id: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + attributes: + $ref: '#/components/schemas/PropertyEntryData_attributes' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - relationships + - type + type: object + PropertyStringType: + properties: + type: + description: Type of property-entry value. + enum: + - string + maxLength: 32 + type: string + value: + description: A string value. + example: Some value + type: string + required: + - type + - value + type: object + PropertyDoubleType: properties: type: - description: Type of metadata value. - example: float + description: Type of property value. + enum: + - double maxLength: 32 type: string value: - description: A numerical floating-point value. - format: float + format: double type: number required: - type - value type: object - MetadataDateType: + PropertyLongType: properties: type: - description: Type of metadata value. - example: date + description: Type of property-entry value. + enum: + - long maxLength: 32 type: string value: - description: A date value. - example: 2022-02-22T10:11:12Z - format: date-time - type: string + description: A numerical long value. + format: int64 + type: integer required: - type - value type: object - MetadataStringType: + PropertyDateType: properties: type: - description: Type of metadata value. - example: string + description: Type of property value. + enum: + - date maxLength: 32 type: string value: - description: A string value. - example: Some value + description: A date value. + example: 2025-02-22T10:11:12Z + format: date-time type: string required: - type - value type: object - MetadataNullType: + PropertySetRelationship: + additionalProperties: false + description: Relationship to a `property-set`. properties: - type: - description: Type of metadata value. - example: "null" - maxLength: 32 - type: string + data: + $ref: '#/components/schemas/PropertySetRelationship_data' required: - - type + - data type: object - PartData: + PartRevisionRelationship: additionalProperties: false + description: Relationship to a `part-revision`. properties: - type: - example: part - type: string - id: - description: ID of the resource. - example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 - format: uuid - maxLength: 36 - type: string - attributes: - $ref: '#/components/schemas/PartData_attributes' - relationships: - $ref: '#/components/schemas/PartData_relationships' - links: - additionalProperties: - $ref: '#/components/schemas/Link' - type: object + data: + $ref: '#/components/schemas/PartData_relationships_partRevisions' required: - - attributes - - id - - type + - data type: object - PartAssemblyRelationship: + SceneItemRelationship: additionalProperties: false - description: Create Part Assembly + description: Relationship to a `scene-item`. properties: data: - $ref: '#/components/schemas/PartAssemblyRelationship_data' + $ref: '#/components/schemas/SceneItemRelationship_data' + required: + - data + type: object + PartInstanceRelationship: + additionalProperties: false + description: Relationship to a `part-instance`. + properties: + data: + $ref: '#/components/schemas/PartInstanceRelationship_data' required: - data type: object @@ -8909,31 +10492,12 @@ components: additionalProperties: false properties: query: - anyOf: - - $ref: '#/components/schemas/QueryById' - - $ref: '#/components/schemas/QueryByCollection' - - $ref: '#/components/schemas/QueryAll' - description: Query `scene-items`. Use `query-by-collection` to combine multiple - queries. + $ref: '#/components/schemas/SceneOperation_query' operations: description: List of operations to perform on `scene-items` matching the query. items: - anyOf: - - $ref: '#/components/schemas/ChangeVisibilityOp' - - $ref: '#/components/schemas/ChangeMaterialOp' - - $ref: '#/components/schemas/ClearMaterialOp' - - $ref: '#/components/schemas/ChangeTransformOp' - - $ref: '#/components/schemas/ClearTransformOp' - - $ref: '#/components/schemas/SelectOp' - - $ref: '#/components/schemas/DeselectOperation' - - $ref: '#/components/schemas/ClearRenOp' - - $ref: '#/components/schemas/ViewDefaultRenOp' - - $ref: '#/components/schemas/ViewRenByIdOp' - - $ref: '#/components/schemas/ViewRenBySuppliedIdOp' - - $ref: '#/components/schemas/ViewRepByIdOp' - - $ref: '#/components/schemas/ViewRepByPredefinedIdOp' - - $ref: '#/components/schemas/ClearRepOp' + $ref: '#/components/schemas/SceneOperation_operations_inner' maxItems: 1024 type: array required: @@ -8942,27 +10506,27 @@ components: type: object Matrix4Nullable: additionalProperties: false - description: 4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) - for details. + description: "4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations)\ + \ for details." example: r0: x: 1.0 - y: 0.0 + "y": 0.0 z: 0.0 w: 0.0 r1: x: 0.0 - y: 1.0 + "y": 1.0 z: 0.0 w: 0.0 r2: x: 0.0 - y: 0.0 + "y": 0.0 z: 1.0 w: 0.0 r3: x: 0.0 - y: 0.0 + "y": 0.0 z: 0.0 w: 1.0 nullable: true @@ -9044,27 +10608,27 @@ components: type: object Matrix4: additionalProperties: false - description: 4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) - for details. + description: "4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations)\ + \ for details." example: r0: x: 1.0 - y: 0.0 + "y": 0.0 z: 0.0 w: 0.0 r1: x: 0.0 - y: 1.0 + "y": 1.0 z: 0.0 w: 0.0 r2: x: 0.0 - y: 0.0 + "y": 0.0 z: 1.0 w: 0.0 r3: x: 0.0 - y: 0.0 + "y": 0.0 z: 0.0 w: 1.0 properties: @@ -9116,15 +10680,6 @@ components: - opacity - specular type: object - SceneItemRelationship: - additionalProperties: false - description: Relationship to a `scene-item`. - properties: - data: - $ref: '#/components/schemas/SceneItemRelationship_data' - required: - - data - type: object MaterialOverride: additionalProperties: false description: Color material override. @@ -9141,15 +10696,6 @@ components: required: - data type: object - PartRevisionRelationship: - additionalProperties: false - description: Relationship to a `part-revision`. - properties: - data: - $ref: '#/components/schemas/PartData_relationships_partRevisions' - required: - - data - type: object CreateSceneItemRequestData: additionalProperties: false properties: @@ -9196,15 +10742,15 @@ components: type: orthographic viewVector: x: 0.0 - y: 0.0 + "y": 0.0 z: 1.0 lookAt: x: 0.0 - y: 0.0 + "y": 0.0 z: 0.0 up: x: 0.0 - y: 1.0 + "y": 1.0 z: 0.0 fovHeight: 1.0 properties: @@ -9295,13 +10841,13 @@ components: - front - up type: object - SceneMetadata: + UpdateSceneMetadata: additionalProperties: maxLength: 256 - minLength: 0 + nullable: true type: string description: | - User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. + User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. A null value will delete the entry in the map, all other key/value pairs provided here will be inserted or updated into the existing scene metadata. type: object SceneRelationship: additionalProperties: false @@ -9370,6 +10916,111 @@ components: - relationships - type type: object + SceneAnnotationSetData: + additionalProperties: false + properties: + type: + example: scene-annotation-set + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/SceneAnnotationSetData_attributes' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - type + type: object + SceneAnnotationCalloutDataType: + description: A type that describes a callout annotation. + properties: + type: + description: The type of annotation. + example: callout + maxLength: 32 + type: string + position: + $ref: '#/components/schemas/Vector3' + icon: + description: | + An optional icon to display for this annotation. See [documentation](https://github.com/Vertexvis/vertex-web-sdk/tree/master/packages/viewer/src/components/viewer-icon#properties) for possible values. + example: comment-show + maxLength: 64 + type: string + primaryColor: + description: A hex color value. + example: '#FFFFFF' + maxLength: 7 + minLength: 7 + pattern: "^#[0-9a-fA-F]{6}$" + type: string + accentColor: + description: A hex color value. + example: '#FFFFFF' + maxLength: 7 + minLength: 7 + pattern: "^#[0-9a-fA-F]{6}$" + type: string + required: + - position + - type + type: object + SceneAnnotationCustomDataType: + additionalProperties: false + description: A type that describes a custom user provided annotation. + properties: + type: + description: The type of annotation. + example: custom + maxLength: 32 + type: string + jsonType: + description: The type of annotation. + example: my-annotation-type + maxLength: 32 + type: string + json: + description: An encoded JSON string associated with the custom annotation. + example: "{\"label\":\"my annotation\",\"anchor\":{\"x\":0,\"y\":0,\"z\"\ + :0}}" + maxLength: 16384 + type: string + required: + - json + - jsonType + - type + type: object + SceneAnnotationData: + additionalProperties: false + properties: + type: + example: scene-annotation + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/SceneAnnotationData_attributes' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - type + type: object UpdateItemToDefaultRenditionOperation: additionalProperties: false description: An operation that updates items with the specified revision to @@ -9441,6 +11092,9 @@ components: - relationships - type type: object + FilterLiteral: + description: A value of a filter. + type: string QueuedTranslationJobData: additionalProperties: false properties: @@ -9558,6 +11212,9 @@ components: attributes: created: 2020-01-01T12:00:00Z topic: some-string + changed: + - some-string + - some-string links: key: href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 @@ -9649,11 +11306,11 @@ components: example: min: x: 0.0 - y: 0.0 + "y": 0.0 z: 0.0 max: x: 100.0 - y: 100.0 + "y": 100.0 z: 100.0 properties: min: @@ -9664,15 +11321,6 @@ components: - max - min type: object - PartRenditionRelationship: - additionalProperties: false - description: Relationship to a `part-rendition`. - properties: - data: - $ref: '#/components/schemas/PartRenditionRelationship_data' - required: - - data - type: object GeometrySetRelationshipData: additionalProperties: false properties: @@ -9739,6 +11387,24 @@ components: required: - ordinal type: object + PropertyKeyType: + properties: + category: + description: The key category + enum: + - vendor + - vertex + - user + type: string + name: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + required: + - category + - name + type: object QueryById: additionalProperties: false properties: @@ -9958,7 +11624,7 @@ components: maxLength: 64 type: string id: - description: A predefined representation identifier, such as `entire-part`. + description: "A predefined representation identifier, such as `entire-part`." enum: - empty - entire-part @@ -9990,7 +11656,7 @@ components: description: x-axis coordinate. example: 1.0 type: number - y: + "y": description: y-axis coordinate. example: 0.0 type: number @@ -10056,13 +11722,19 @@ components: additionalProperties: false properties: suppliedPartId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." maxLength: 1024 type: string suppliedRevisionId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." + maxLength: 1024 + type: string + suppliedIterationId: + description: "Optional iteration ID for the revision. For example, a generated\ + \ version id from a PLM system to a specific revision. Used when a existing\ + \ revision is modified." maxLength: 1024 type: string required: @@ -10082,6 +11754,14 @@ components: - normal - offset type: object + SceneMetadata: + additionalProperties: + maxLength: 256 + minLength: 0 + type: string + description: | + User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. + type: object ThumbnailData: additionalProperties: false properties: @@ -10107,6 +11787,13 @@ components: - color - width type: object + HexColor: + description: A hex color value. + example: '#FFFFFF' + maxLength: 7 + minLength: 7 + pattern: "^#[0-9a-fA-F]{6}$" + type: string ExportConfig: description: Describes the options for configuring a file export. discriminator: @@ -10165,6 +11852,9 @@ components: example: created: 2020-01-01T12:00:00Z topic: some-string + changed: + - some-string + - some-string properties: created: example: 2020-01-01T12:00:00Z @@ -10175,6 +11865,10 @@ components: maxLength: 1024 minLength: 1 type: string + changed: + items: + $ref: '#/components/schemas/NonEmptyString' + type: array required: - created - topic @@ -10460,24 +12154,30 @@ components: CreateFileRequest_data_attributes: properties: name: - description: Name matching that of the file you are uploading, including - file extension. + description: "Name matching that of the file you are uploading, including\ + \ file extension." example: model.zip maxLength: 1024 minLength: 1 type: string suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 type: string rootFileName: - description: File name of the root part or assembly, including file extension. - Required if `name` references an archive file extension, ignored otherwise. + description: "File name of the root part or assembly, including file extension.\ + \ Required if `name` references an archive file extension, ignored otherwise." example: root-assembly.prt.1 maxLength: 1024 type: string + expiry: + description: Number of seconds before the file is deleted. + example: 600 + format: int32 + minimum: 1 + type: integer required: - name type: object @@ -10494,6 +12194,29 @@ components: - attributes - type type: object + UpdateFileRequest_data_attributes: + properties: + expiry: + description: Number of seconds before the file is deleted. + example: 600 + format: int32 + minimum: 1 + nullable: true + type: integer + type: object + UpdateFileRequest_data: + properties: + type: + description: Resource object type. + example: file + maxLength: 32 + type: string + attributes: + $ref: '#/components/schemas/UpdateFileRequest_data_attributes' + required: + - attributes + - type + type: object CreateGeometrySetRequest_data_relationships: properties: source: @@ -10642,12 +12365,7 @@ components: properties: metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' description: | Metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. type: object @@ -10681,6 +12399,13 @@ components: maxLength: 255 type: string type: object + UpdatePartRevisionRequest_data_relationships: + properties: + source: + $ref: '#/components/schemas/FileRelationship' + defaultPartRendition: + $ref: '#/components/schemas/PartRenditionRelationship' + type: object UpdatePartRevisionRequest_data: description: | Modify existing part revisions using this endpoint. When specifying a `relationship`, the generated output from that relationship will be used to replace any relationship that is present on the revision prior to the update. @@ -10700,7 +12425,7 @@ components: attributes: $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes' relationships: - $ref: '#/components/schemas/CreateGeometrySetRequest_data_relationships' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_relationships' required: - attributes - id @@ -10713,8 +12438,8 @@ components: maxLength: 255 type: string suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 255 type: string @@ -10767,6 +12492,16 @@ components: example: RevA maxLength: 1024 type: string + suppliedIterationId: + description: | + ID provided for correlation of the revision. This is an optional ID to be able to create + a version of a revision. For example, if and existing revision in a PLM system is modified, + the suppliedIterationId can be used to allow creating a new part revision having an already + existing suppliedId and suppliedRevisionId. This can be used when modification to an existing + revision is made in the PLM system before the revision is released. + example: Ver1 + maxLength: 1024 + type: string indexMetadata: description: | Whether or not to index metadata in the part file. To ignore metadata from the part file and add your own, pass `false` for `indexMetadata` and supply custom metadata using the `metadata` field. @@ -10774,12 +12509,7 @@ components: type: boolean metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' description: | Additional metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. type: object @@ -10812,26 +12542,58 @@ components: CreatePartRequest_data_relationships: properties: source: - anyOf: - - $ref: '#/components/schemas/FileRelationship' - - $ref: '#/components/schemas/PartAssemblyRelationship' + $ref: '#/components/schemas/CreatePartRequest_data_relationships_source' required: - source type: object - CreatePartRequest_data: + CreatePartRequest_data: + properties: + type: + description: Resource object type. Specify one and only one of suppliedId + or suppliedIdKey and one and only one of suppliedRevisionId or suppliedRevisionIdKey. + example: part + maxLength: 32 + type: string + attributes: + $ref: '#/components/schemas/CreatePartRequest_data_attributes' + relationships: + $ref: '#/components/schemas/CreatePartRequest_data_relationships' + required: + - attributes + - type + type: object + UpsertPropertyEntriesRequest_data_attributes: + properties: + entries: + additionalProperties: + $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data_attributes_entries_value' + description: | + Property entries for a provided resource or property set. + type: object + required: + - entries + type: object + UpsertPropertyEntriesRequest_data_relationships: + properties: + propertySet: + $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data_relationships_propertySet' + required: + - propertySet + type: object + UpsertPropertyEntriesRequest_data: properties: type: - description: Resource object type. Specify one and only one of suppliedId - or suppliedIdKey and one and only one of suppliedRevisionId or suppliedRevisionIdKey. - example: part + description: Resource object type. + example: property-entries maxLength: 32 type: string attributes: - $ref: '#/components/schemas/CreatePartRequest_data_attributes' + $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data_attributes' relationships: - $ref: '#/components/schemas/CreatePartRequest_data_relationships' + $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data_relationships' required: - attributes + - relationships - type type: object CreateSceneAlterationRequest_data_attributes: @@ -10957,19 +12719,14 @@ components: minLength: 1 type: string suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 type: string metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' description: | Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. type: object @@ -10983,10 +12740,7 @@ components: UpdateSceneItemRequest_data_relationships: properties: source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - description: Relationship to a `geometry-set` or `part-revision`. + $ref: '#/components/schemas/UpdateSceneItemRequest_data_relationships_source' type: object UpdateSceneItemRequest_data: properties: @@ -11006,10 +12760,7 @@ components: UpdateSceneViewRequest_data_attributes: properties: camera: - anyOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' - - $ref: '#/components/schemas/CameraFit' + $ref: '#/components/schemas/UpdateSceneViewRequest_data_attributes_camera' crossSectioning: $ref: '#/components/schemas/CrossSectioning' noDefaultLights: @@ -11033,9 +12784,7 @@ components: CreateSceneViewRequest_data_attributes: properties: camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' + $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' crossSectioning: $ref: '#/components/schemas/CrossSectioning' excludePrunedItems: @@ -11066,12 +12815,10 @@ components: CreateSceneRequest_data_attributes: properties: camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' + $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 type: string @@ -11088,10 +12835,10 @@ components: metadata: additionalProperties: maxLength: 256 - minLength: 0 + nullable: true type: string description: | - User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. + User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. A null value will delete the entry in the map, all other key/value pairs provided here will be inserted or updated into the existing scene metadata. type: object type: object CreateSceneRequest_data_relationships: @@ -11119,10 +12866,7 @@ components: UpdateSceneRequest_data_attributes: properties: camera: - anyOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' - - $ref: '#/components/schemas/CameraFit' + $ref: '#/components/schemas/UpdateSceneViewRequest_data_attributes_camera' state: description: State of the scene. enum: @@ -11132,10 +12876,11 @@ components: maxLength: 32 type: string suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 + nullable: true type: string name: example: some-string @@ -11147,6 +12892,14 @@ components: type: boolean worldOrientation: $ref: '#/components/schemas/Orientation' + metadata: + additionalProperties: + maxLength: 256 + nullable: true + type: string + description: | + User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. A null value will delete the entry in the map, all other key/value pairs provided here will be inserted or updated into the existing scene metadata. + type: object type: object UpdateSceneRequest_data: properties: @@ -11169,8 +12922,8 @@ components: minLength: 1 type: string suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 type: string @@ -11178,9 +12931,7 @@ components: CreateSceneViewStateRequest_data_relationships: properties: source: - oneOf: - - $ref: '#/components/schemas/SceneViewRelationship' - - $ref: '#/components/schemas/SceneViewStateRelationship' + $ref: '#/components/schemas/CreateSceneViewStateRequest_data_relationships_source' required: - source type: object @@ -11240,6 +12991,81 @@ components: - attributes - type type: object + CreateSceneAnnotationSetRequest_data_attributes: + properties: + name: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + suppliedId: + description: A customer provided ID used for correlation. + example: PN12345 + maxLength: 256 + type: string + type: object + CreateSceneAnnotationSetRequest_data: + properties: + type: + description: Resource object type. + example: scene-annotation-set + maxLength: 32 + type: string + attributes: + $ref: '#/components/schemas/CreateSceneAnnotationSetRequest_data_attributes' + required: + - attributes + - type + type: object + CreateSceneAnnotationRequest_data_attributes: + properties: + data: + $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes_data' + suppliedId: + description: A customer provided ID used for correlation. + example: PN12345 + maxLength: 256 + type: string + required: + - data + type: object + CreateSceneAnnotationRequest_data: + properties: + type: + description: Resource object type. + example: scene-annotation + maxLength: 32 + type: string + attributes: + $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes' + required: + - attributes + - type + type: object + UpdateSceneAnnotationRequest_data_attributes: + properties: + data: + $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes_data' + suppliedId: + description: A customer provided ID used for correlation. + example: PN12345 + maxLength: 256 + nullable: true + type: string + type: object + UpdateSceneAnnotationRequest_data: + properties: + type: + description: Resource object type. + example: scene-annotation + maxLength: 32 + type: string + attributes: + $ref: '#/components/schemas/UpdateSceneAnnotationRequest_data_attributes' + required: + - attributes + - type + type: object CreateTranslationInspectionRequest_data: properties: type: @@ -11287,15 +13113,7 @@ components: CreateExportRequest_data_attributes: properties: config: - description: Specifies the export format and options to configure the export. - discriminator: - mapping: - jt: '#/components/schemas/CADExportConfig' - step: '#/components/schemas/CADExportConfig' - x_t: '#/components/schemas/CADExportConfig' - propertyName: format - oneOf: - - $ref: '#/components/schemas/CADExportConfig' + $ref: '#/components/schemas/CreateExportRequest_data_attributes_config' fileName: description: Optional file name to use for the resulting export example: exportedScene @@ -11395,7 +13213,7 @@ components: example: /body/data/attributes type: string parameter: - example: page[cursor] + example: "page[cursor]" type: string type: object ApplicationData_attributes: @@ -11554,12 +13372,7 @@ components: $ref: '#/components/schemas/ColorMaterial' metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' type: object name: example: some-string @@ -11584,11 +13397,7 @@ components: SceneItemData_relationships: properties: source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - - $ref: '#/components/schemas/SceneRelationship' - - $ref: '#/components/schemas/PartRenditionRelationship' + $ref: '#/components/schemas/SceneItemData_relationships_source' parent: $ref: '#/components/schemas/SceneItemRelationship' partRendition: @@ -11602,18 +13411,18 @@ components: type: string metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' type: object suppliedId: example: some-string maxLength: 1024 minLength: 1 type: string + suppliedIterationId: + example: some-string + maxLength: 1024 + minLength: 1 + type: string name: example: some-string maxLength: 1024 @@ -11653,6 +13462,43 @@ components: partRevision: $ref: '#/components/schemas/PartRevisionRelationship' type: object + PartRenditionRelationship_data: + properties: + type: + description: Resource object type. + enum: + - part-rendition + example: part-rendition + maxLength: 32 + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + required: + - id + - type + type: object + PartRevisionInstanceData_attributes: + properties: + ordinal: + description: A 0-based index used for defining a consistent ordering for + children of an assembly + minimum: 0 + type: integer + transform: + $ref: '#/components/schemas/Matrix4' + type: object + PartRevisionInstanceData_relationships: + description: This is the relationship from the instance to the parent revision + properties: + partRevision: + $ref: '#/components/schemas/PartRevisionRelationship' + required: + - partRevision + type: object PartData_attributes: properties: name: @@ -11710,18 +13556,87 @@ components: type: array metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' description: | Additional metadata about the `part` and/or `part-revision`. type: object required: - children type: object + ModelViewData_relationships: + properties: + partRevision: + $ref: '#/components/schemas/PartRevisionRelationship' + required: + - partRevision + type: object + PropertyEntryData_attributes: + properties: + value: + $ref: '#/components/schemas/PropertyEntryData_attributes_value' + key: + $ref: '#/components/schemas/PropertyKeyType' + required: + - key + - value + type: object + PropertySetRelationship_data: + properties: + type: + description: Resource object type. + enum: + - property-set + example: property-set + maxLength: 32 + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + required: + - id + - type + type: object + SceneItemRelationship_data: + properties: + type: + description: Resource object type. + enum: + - scene-item + example: scene-item + maxLength: 32 + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + required: + - id + - type + type: object + PartInstanceRelationship_data: + properties: + type: + description: Resource object type. + enum: + - part-instance + example: part-instance + maxLength: 32 + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + required: + - id + - type + type: object SceneAlterationData_relationships: properties: sceneView: @@ -11761,25 +13676,6 @@ components: - sceneItem - sceneView type: object - SceneItemRelationship_data: - properties: - type: - description: Resource object type. - enum: - - scene-item - example: scene-item - maxLength: 32 - type: string - id: - description: ID of the resource. - example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 - format: uuid - maxLength: 36 - type: string - required: - - id - - type - type: object CreateSceneItemRequestData_attributes: properties: materialOverride: @@ -11807,8 +13703,8 @@ components: source: $ref: '#/components/schemas/PartRevisionSuppliedId' suppliedId: - description: ID provided for correlation. For example, an existing ID from - a PLM system. + description: "ID provided for correlation. For example, an existing ID from\ + \ a PLM system." example: PN12345 maxLength: 1024 type: string @@ -11826,37 +13722,31 @@ components: type: boolean metadata: additionalProperties: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' + $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' description: | Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. type: object + experimentalSourceMetadataKeys: + description: | + Specifies which metadata keys should be copied from the source item. Sending null will default to all keys. Sending an empty string will copy none of the sources' metadata. Sending an array of ["KEY1", "KEY2] will include KEY1 and KEY2 from the source in the scene item creation. This is marked experimental since future releases are expected to prevent copying metadata entirely. + items: + type: string + maxItems: 500 + type: array type: object CreateSceneItemRequestData_relationships: properties: parent: $ref: '#/components/schemas/SceneItemRelationship' source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - - $ref: '#/components/schemas/SceneRelationship' - - $ref: '#/components/schemas/PartRenditionRelationship' - description: Relationship to a `geometry-set`, `part-revision`, `part-rendition`, - or `scene`. + $ref: '#/components/schemas/CreateSceneItemRequestData_relationships_source' referenceTree: $ref: '#/components/schemas/SceneItemRelationship' type: object SceneViewData_attributes: properties: camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' + $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' created: example: 2020-01-01T12:00:00Z format: date-time @@ -11902,9 +13792,7 @@ components: SceneData_attributes: properties: camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' + $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' state: example: draft type: string @@ -11966,9 +13854,7 @@ components: SceneViewStateData_attributes: properties: camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' + $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' created: example: 2020-01-01T12:00:00Z format: date-time @@ -12031,6 +13917,52 @@ components: - created - expiry type: object + SceneAnnotationSetData_attributes: + properties: + createdAt: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + modifiedAt: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + name: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + suppliedId: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + required: + - createdAt + - modifiedAt + type: object + SceneAnnotationData_attributes: + properties: + createdAt: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + modifiedAt: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + data: + $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes_data' + suppliedId: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + required: + - createdAt + - data + - modifiedAt + type: object SceneSyncData_attributes: properties: created: @@ -12142,25 +14074,6 @@ components: - topics - url type: object - PartRenditionRelationship_data: - properties: - type: - description: Resource object type. - enum: - - part-rendition - example: part-rendition - maxLength: 32 - type: string - id: - description: ID of the resource. - example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 - format: uuid - maxLength: 36 - type: string - required: - - id - - type - type: object QueryById_data_attributes: properties: type: @@ -12303,6 +14216,145 @@ components: required: - data type: object + Batch_vertexvis_batch_results_inner: + anyOf: + - $ref: '#/components/schemas/RelationshipData' + - $ref: '#/components/schemas/ApiError' + Hit_included_inner: + oneOf: + - $ref: '#/components/schemas/HitResultData' + - $ref: '#/components/schemas/SceneItemData' + - $ref: '#/components/schemas/PartRevisionData' + CreateSceneSyncRequest_operation: + discriminator: + mapping: + update-to-default-rendition: '#/components/schemas/UpdateItemToDefaultRenditionOperation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/UpdateItemToDefaultRenditionOperation' + QueuedTranslationJob_included_inner: + anyOf: + - $ref: '#/components/schemas/GeometrySetData' + - $ref: '#/components/schemas/PartRevisionData' + - $ref: '#/components/schemas/PartRenditionData' + WebhookEvent_included_inner: + discriminator: + mapping: + scene: '#/components/schemas/WebhookEventSceneIncludedData' + part-revision: '#/components/schemas/WebhookEventPartRevisionIncludedData' + propertyName: type + oneOf: + - $ref: '#/components/schemas/WebhookEventSceneIncludedData' + - $ref: '#/components/schemas/WebhookEventPartRevisionIncludedData' + SceneOperation_query: + anyOf: + - $ref: '#/components/schemas/QueryById' + - $ref: '#/components/schemas/QueryByCollection' + - $ref: '#/components/schemas/QueryAll' + description: Query `scene-items`. Use `query-by-collection` to combine multiple + queries. + SceneOperation_operations_inner: + anyOf: + - $ref: '#/components/schemas/ChangeVisibilityOp' + - $ref: '#/components/schemas/ChangeMaterialOp' + - $ref: '#/components/schemas/ClearMaterialOp' + - $ref: '#/components/schemas/ChangeTransformOp' + - $ref: '#/components/schemas/ClearTransformOp' + - $ref: '#/components/schemas/SelectOp' + - $ref: '#/components/schemas/DeselectOperation' + - $ref: '#/components/schemas/ClearRenOp' + - $ref: '#/components/schemas/ViewDefaultRenOp' + - $ref: '#/components/schemas/ViewRenByIdOp' + - $ref: '#/components/schemas/ViewRenBySuppliedIdOp' + - $ref: '#/components/schemas/ViewRepByIdOp' + - $ref: '#/components/schemas/ViewRepByPredefinedIdOp' + - $ref: '#/components/schemas/ClearRepOp' + UpdatePartRevisionRequest_data_attributes_metadata_value: + anyOf: + - $ref: '#/components/schemas/MetadataLongType' + - $ref: '#/components/schemas/MetadataFloatType' + - $ref: '#/components/schemas/MetadataDateType' + - $ref: '#/components/schemas/MetadataStringType' + - $ref: '#/components/schemas/MetadataNullType' + CreatePartRequest_data_relationships_source: + anyOf: + - $ref: '#/components/schemas/FileRelationship' + - $ref: '#/components/schemas/PartAssemblyRelationship' + UpsertPropertyEntriesRequest_data_attributes_entries_value: + anyOf: + - $ref: '#/components/schemas/PropertyStringType' + - $ref: '#/components/schemas/PropertyDoubleType' + - $ref: '#/components/schemas/PropertyLongType' + - $ref: '#/components/schemas/PropertyDateType' + - nullable: true + type: object + nullable: true + UpsertPropertyEntriesRequest_data_relationships_propertySet: + anyOf: + - $ref: '#/components/schemas/PropertySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneItemRelationship' + - $ref: '#/components/schemas/PartInstanceRelationship' + description: "Relationship to the property set by `property-set`, `part-revision`,\ + \ `part-instance` or `scene-item`." + UpdateSceneItemRequest_data_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + description: Relationship to a `geometry-set` or `part-revision`. + UpdateSceneViewRequest_data_attributes_camera: + anyOf: + - $ref: '#/components/schemas/PerspectiveCamera' + - $ref: '#/components/schemas/OrthographicCamera' + - $ref: '#/components/schemas/CameraFit' + CreateSceneViewRequest_data_attributes_camera: + oneOf: + - $ref: '#/components/schemas/PerspectiveCamera' + - $ref: '#/components/schemas/OrthographicCamera' + CreateSceneViewStateRequest_data_relationships_source: + oneOf: + - $ref: '#/components/schemas/SceneViewRelationship' + - $ref: '#/components/schemas/SceneViewStateRelationship' + CreateSceneAnnotationRequest_data_attributes_data: + description: The data describing how to render this annotation. + discriminator: + mapping: + callout: '#/components/schemas/SceneAnnotationCalloutDataType' + custom: '#/components/schemas/SceneAnnotationCustomDataType' + propertyName: type + oneOf: + - $ref: '#/components/schemas/SceneAnnotationCalloutDataType' + - $ref: '#/components/schemas/SceneAnnotationCustomDataType' + CreateExportRequest_data_attributes_config: + description: Specifies the export format and options to configure the export. + discriminator: + mapping: + jt: '#/components/schemas/CADExportConfig' + step: '#/components/schemas/CADExportConfig' + x_t: '#/components/schemas/CADExportConfig' + propertyName: format + oneOf: + - $ref: '#/components/schemas/CADExportConfig' + SceneItemData_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneRelationship' + - $ref: '#/components/schemas/PartRenditionRelationship' + PropertyEntryData_attributes_value: + anyOf: + - $ref: '#/components/schemas/PropertyStringType' + - $ref: '#/components/schemas/PropertyDoubleType' + - $ref: '#/components/schemas/PropertyLongType' + - $ref: '#/components/schemas/PropertyDateType' + CreateSceneItemRequestData_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneRelationship' + - $ref: '#/components/schemas/PartRenditionRelationship' + description: "Relationship to a `geometry-set`, `part-revision`, `part-rendition`,\ + \ or `scene`." securitySchemes: OAuth2: flows: diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..e6441136f3d4ba8a0da8d277868979cfbc8ad796 100644 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n*=4<|!MJu@}isLc4AW#{m2if&A5T5g&~ ziuMQeS*U5sL6J698wOd)K@oK@1{peP5&Esut<#VH^u)gp`9H4)`uE!2$>RTctN+^u z=ASkePDZA-X8)rp%D;p*~P?*a_=*Kwc<^>QSH|^<0>o37lt^+Mj1;4YvJ(JR-Y+?%Nu}JAYj5 z_Qc5%Ao#F?q32i?ZaN2OSNhWL;2oDEw_({7ZbgUjna!Fqn3NzLM@-EWFPZVmc>(fZ z0&bF-Ch#p9C{YJT9Rcr3+Y_uR^At1^BxZ#eo>$PLJF3=;t_$2|t+_6gg5(j{TmjYU zK12c&lE?Eh+2u2&6Gf*IdKS&6?rYbSEKBN!rv{YCm|Rt=UlPcW9j`0o6{66#y5t9C zruFA2iKd=H%jHf%ypOkxLnO8#H}#Zt{8p!oi6)7#NqoF({t6|J^?1e*oxqng9Q2Cc zg%5Vu!em)}Yuj?kaP!D?b?(C*w!1;>R=j90+RTkyEXz+9CufZ$C^umX^+4|JYaO<5 zmIM3#dv`DGM;@F6;(t!WngZSYzHx?9&$xEF70D1BvfVj<%+b#)vz)2iLCrTeYzUcL z(OBnNoG6Le%M+@2oo)&jdOg=iCszzv59e zDRCeaX8l1hC=8LbBt|k5?CXgep=3r9BXx1uR8!p%Z|0+4Xro=xi0G!e{c4U~1j6!) zH6adq0}#l{%*1U(Cb%4AJ}VLWKBPi0MoKFaQH6x?^hQ!6em@993xdtS%_dmevzeNl z(o?YlOI=jl(`L9^ z0O+H9k$_@`6L13eTT8ci-V0ljDMD|0ifUw|Q-Hep$xYj0hTO@0%IS^TD4b4n6EKDG z??uM;MEx`s98KYN(K0>c!C3HZdZ{+_53DO%9k5W%pr6yJusQAv_;IA}925Y%;+!tY z%2k!YQmLLOr{rF~!s<3-WEUs)`ix_mSU|cNRBIWxOox_Yb7Z=~Q45ZNe*u|m^|)d* zog=i>`=bTe!|;8F+#H>EjIMcgWcG2ORD`w0WD;YZAy5#s{65~qfI6o$+Ty&-hyMyJ z3Ra~t>R!p=5ZpxA;QkDAoPi4sYOP6>LT+}{xp}tk+<0k^CKCFdNYG(Es>p0gqD)jP zWOeX5G;9(m@?GOG7g;e74i_|SmE?`B2i;sLYwRWKLy0RLW!Hx`=!LH3&k=FuCsM=9M4|GqzA)anEHfxkB z?2iK-u(DC_T1};KaUT@3nP~LEcENT^UgPvp!QC@Dw&PVAhaEYrPey{nkcn(ro|r7XUz z%#(=$7D8uP_uU-oPHhd>>^adbCSQetgSG`e$U|7mr!`|bU0aHl_cmL)na-5x1#OsVE#m*+k84Y^+UMeSAa zbrVZHU=mFwXEaGHtXQq`2ZtjfS!B2H{5A<3(nb-6ARVV8kEmOkx6D2x7~-6hl;*-*}2Xz;J#a8Wn;_B5=m zl3dY;%krf?i-Ok^Pal-}4F`{F@TYPTwTEhxpZK5WCpfD^UmM_iYPe}wpE!Djai6_{ z*pGO=WB47#Xjb7!n2Ma)s^yeR*1rTxp`Mt4sfA+`HwZf%!7ZqGosPkw69`Ix5Ku6G z@Pa;pjzV&dn{M=QDx89t?p?d9gna*}jBly*#1!6}5K<*xDPJ{wv4& zM$17DFd~L*Te3A%yD;Dp9UGWTjRxAvMu!j^Tbc}2v~q^59d4bz zvu#!IJCy(BcWTc`;v$9tH;J%oiSJ_i7s;2`JXZF+qd4C)vY!hyCtl)sJIC{ebI*0> z@x>;EzyBv>AI-~{D6l6{ST=em*U( z(r$nuXY-#CCi^8Z2#v#UXOt`dbYN1z5jzNF2 z411?w)whZrfA20;nl&C1Gi+gk<`JSm+{|*2o<< zqM#@z_D`Cn|0H^9$|Tah)0M_X4c37|KQ*PmoT@%xHc3L1ZY6(p(sNXHa&49Frzto& zR`c~ClHpE~4Z=uKa5S(-?M8EJ$zt0&fJk~p$M#fGN1-y$7!37hld`Uw>Urri(DxLa;=#rK0g4J)pXMC zxzraOVw1+kNWpi#P=6(qxf`zSdUC?D$i`8ZI@F>k6k zz21?d+dw7b&i*>Kv5L(LH-?J%@WnqT7j#qZ9B>|Zl+=> z^U-pV@1y_ptHo4hl^cPRWewbLQ#g6XYQ@EkiP z;(=SU!yhjHp%1&MsU`FV1Z_#K1&(|5n(7IHbx&gG28HNT)*~-BQi372@|->2Aw5It z0CBpUcMA*QvsPy)#lr!lIdCi@1k4V2m!NH)%Px(vu-r(Q)HYc!p zJ^$|)j^E#q#QOgcb^pd74^JUi7fUmMiNP_o*lvx*q%_odv49Dsv$NV;6J z9GOXKomA{2Pb{w}&+yHtH?IkJJu~}Z?{Uk++2mB8zyvh*xhHKE``99>y#TdD z&(MH^^JHf;g(Tbb^&8P*;_i*2&fS$7${3WJtV7K&&(MBV2~)2KB3%cWg#1!VE~k#C z!;A;?p$s{ihyojEZz+$I1)L}&G~ml=udD9qh>Tu(ylv)?YcJT3ihapi!zgPtWb*CP zlLLJSRCj-^w?@;RU9aL2zDZY1`I3d<&OMuW=c3$o0#STpv_p3b9Wtbql>w^bBi~u4 z3D8KyF?YE?=HcKk!xcp@Cigvzy=lnFgc^9c%(^F22BWYNAYRSho@~*~S)4%AhEttv zvq>7X!!EWKG?mOd9&n>vvH1p4VzE?HCuxT-u+F&mnsfDI^}*-d00-KAauEaXqg3k@ zy#)MGX!X;&3&0s}F3q40ZmVM$(H3CLfpdL?hB6nVqMxX)q=1b}o_PG%r~hZ4gUfSp zOH4qlEOW4OMUc)_m)fMR_rl^pCfXc{$fQbI*E&mV77}kRF z&{<06AJyJ!e863o-V>FA1a9Eemx6>^F$~9ppt()ZbPGfg_NdRXBWoZnDy2;#ODgf! zgl?iOcF7Meo|{AF>KDwTgYrJLb$L2%%BEtO>T$C?|9bAB&}s;gI?lY#^tttY&hfr# zKhC+&b-rpg_?~uVK%S@mQleU#_xCsvIPK*<`E0fHE1&!J7!xD#IB|SSPW6-PyuqGn3^M^Rz%WT{e?OI^svARX&SAdU77V(C~ zM$H{Kg59op{<|8ry9ecfP%=kFm(-!W&?U0@<%z*+!*<e0XesMxRFu9QnGqun6R_%T+B%&9Dtk?*d$Q zb~>84jEAPi@&F@3wAa^Lzc(AJz5gsfZ7J53;@D<;Klpl?sK&u@gie`~vTsbOE~Cd4 z%kr56mI|#b(Jk&;p6plVwmNB0H@0SmgdmjIn5Ne@)}7Vty(yb2t3ev@22AE^s!KaN zyQ>j+F3w=wnx7w@FVCRe+`vUH)3gW%_72fxzqX!S&!dchdkRiHbXW1FMrIIBwjsai8`CB2r4mAbwp%rrO>3B$Zw;9=%fXI9B{d(UzVap7u z6piC-FQ)>}VOEuPpuqznpY`hN4dGa_1Xz9rVg(;H$5Te^F0dDv*gz9JS<|>>U0J^# z6)(4ICh+N_Q`Ft0hF|3fSHs*?a=XC;e`sJaU9&d>X4l?1W=|fr!5ShD|nv$GK;j46@BV6+{oRbWfqOBRb!ir88XD*SbC(LF}I1h#6@dvK%Toe%@ zhDyG$93H8Eu&gCYddP58iF3oQH*zLbNI;rN@E{T9%A8!=v#JLxKyUe}e}BJpB{~uN zqgxRgo0*-@-iaHPV8bTOH(rS(huwK1Xg0u+e!`(Irzu@Bld&s5&bWgVc@m7;JgELd zimVs`>vQ}B_1(2#rv#N9O`fJpVfPc7V2nv34PC);Dzbb;p!6pqHzvy?2pD&1NE)?A zt(t-ucqy@wn9`^MN5apa7K|L=9>ISC>xoc#>{@e}m#YAAa1*8-RUMKwbm|;5p>T`Z zNf*ph@tnF{gmDa3uwwN(g=`Rh)4!&)^oOy@VJaK4lMT&5#YbXkl`q?<*XtsqD z9PRK6bqb)fJw0g-^a@nu`^?71k|m3RPRjt;pIkCo1{*pdqbVs-Yl>4E>3fZx3Sv44grW=*qdSoiZ9?X0wWyO4`yDHh2E!9I!ZFi zVL8|VtW38}BOJHW(Ax#KL_KQzarbuE{(%TA)AY)@tY4%A%P%SqIU~8~-Lp3qY;U-} z`h_Gel7;K1h}7$_5ZZT0&%$Lxxr-<89V&&TCsu}LL#!xpQ1O31jaa{U34~^le*Y%L za?7$>Jk^k^pS^_M&cDs}NgXlR>16AHkSK-4TRaJSh#h&p!-!vQY%f+bmn6x`4fwTp z$727L^y`~!exvmE^W&#@uY!NxJi`g!i#(++!)?iJ(1)2Wk;RN zFK&O4eTkP$Xn~4bB|q8y(btx$R#D`O@epi4ofcETrx!IM(kWNEe42Qh(8*KqfP(c0 zouBl6>Fc_zM+V;F3znbo{x#%!?mH3`_ANJ?y7ppxS@glg#S9^MXu|FM&ynpz3o&Qh z2ujAHLF3($pH}0jXQsa#?t--TnF1P73b?4`KeJ9^qK-USHE)4!IYgMn-7z|=ALF5SNGkrtPG@Y~niUQV2?g$vzJN3nZ{7;HZHzWAeQ;5P|@Tl3YHpyznGG4-f4=XflwSJY+58-+wf?~Fg@1p1wkzuu-RF3j2JX37SQUc? zQ4v%`V8z9ZVZVqS8h|@@RpD?n0W<=hk=3Cf8R?d^9YK&e9ZybFY%jdnA)PeHvtBe- zhMLD+SSteHBq*q)d6x{)s1UrsO!byyLS$58WK;sqip$Mk{l)Y(_6hEIBsIjCr5t>( z7CdKUrJTrW%qZ#1z^n*Lb8#VdfzPw~OIL76aC+Rhr<~;4Tl!sw?Rj6hXj4XWa#6Tp z@)kJ~qOV)^Rh*-?aG>ic2*NlC2M7&LUzc9RT6WM%Cpe78`iAowe!>(T0jo&ivn8-7 zs{Qa@cGy$rE-3AY0V(l8wjI^uB8Lchj@?L}fYal^>T9z;8juH@?rG&g-t+R2dVDBe zq!K%{e-rT5jX19`(bP23LUN4+_zh2KD~EAYzhpEO3MUG8@}uBHH@4J zd`>_(K4q&>*k82(dDuC)X6JuPrBBubOg7qZ{?x!r@{%0);*`h*^F|%o?&1wX?Wr4b z1~&cy#PUuES{C#xJ84!z<1tp9sfrR(i%Tu^jnXy;4`Xk;AQCdFC@?V%|; zySdC7qS|uQRcH}EFZH%mMB~7gi}a0utE}ZE_}8PQH8f;H%PN41Cb9R%w5Oi5el^fd z$n{3SqLCnrF##x?4sa^r!O$7NX!}&}V;0ZGQ&K&i%6$3C_dR%I7%gdQ;KT6YZiQrW zk%q<74oVBV>@}CvJ4Wj!d^?#Zwq(b$E1ze4$99DuNg?6t9H}k_|D7KWD7i0-g*EO7 z;5{hSIYE4DMOK3H%|f5Edx+S0VI0Yw!tsaRS2&Il2)ea^8R5TG72BrJue|f_{2UHa z@w;^c|K3da#$TB0P3;MPlF7RuQeXT$ zS<<|C0OF(k)>fr&wOB=gP8!Qm>F41u;3esv7_0l%QHt(~+n; zf!G6%hp;Gfa9L9=AceiZs~tK+Tf*Wof=4!u{nIO90jH@iS0l+#%8=~%ASzFv7zqSB^?!@N7)kp0t&tCGLmzXSRMRyxCmCYUD2!B`? zhs$4%KO~m=VFk3Buv9osha{v+mAEq=ik3RdK@;WWTV_g&-$U4IM{1IhGX{pAu%Z&H zFfwCpUsX%RKg);B@7OUzZ{Hn{q6Vv!3#8fAg!P$IEx<0vAx;GU%}0{VIsmFBPq_mb zpe^BChDK>sc-WLKl<6 zwbW|e&d&dv9Wu0goueyu>(JyPx1mz0v4E?cJjFuKF71Q1)AL8jHO$!fYT3(;U3Re* zPPOe%*O+@JYt1bW`!W_1!mN&=w3G9ru1XsmwfS~BJ))PhD(+_J_^N6j)sx5VwbWK| zwRyC?W<`pOCY)b#AS?rluxuuGf-AJ=D!M36l{ua?@SJ5>e!IBr3CXIxWw5xUZ@Xrw z_R@%?{>d%Ld4p}nEsiA@v*nc6Ah!MUs?GA7e5Q5lPpp0@`%5xY$C;{%rz24$;vR#* zBP=a{)K#CwIY%p} zXVdxTQ^HS@O&~eIftU+Qt^~(DGxrdi3k}DdT^I7Iy5SMOp$QuD8s;+93YQ!OY{eB24%xY7ml@|M7I(Nb@K_-?F;2?et|CKkuZK_>+>Lvg!>JE~wN`BI|_h6$qi!P)+K-1Hh(1;a`os z55)4Q{oJiA(lQM#;w#Ta%T0jDNXIPM_bgESMCDEg6rM33anEr}=|Fn6)|jBP6Y}u{ zv9@%7*#RI9;fv;Yii5CI+KrRdr0DKh=L>)eO4q$1zmcSmglsV`*N(x=&Wx`*v!!hn6X-l0 zP_m;X??O(skcj+oS$cIdKhfT%ABAzz3w^la-Ucw?yBPEC+=Pe_vU8nd-HV5YX6X8r zZih&j^eLU=%*;VzhUyoLF;#8QsEfmByk+Y~caBqSvQaaWf2a{JKB9B>V&r?l^rXaC z8)6AdR@Qy_BxQrE2Fk?ewD!SwLuMj@&d_n5RZFf7=>O>hzVE*seW3U?_p|R^CfoY`?|#x9)-*yjv#lo&zP=uI`M?J zbzC<^3x7GfXA4{FZ72{PE*-mNHyy59Q;kYG@BB~NhTd6pm2Oj=_ zizmD?MKVRkT^KmXuhsk?eRQllPo2Ubk=uCKiZ&u3Xjj~<(!M94c)Tez@9M1Gfs5JV z->@II)CDJOXTtPrQudNjE}Eltbjq>6KiwAwqvAKd^|g!exgLG3;wP+#mZYr`cy3#39e653d=jrR-ulW|h#ddHu(m9mFoW~2yE zz5?dB%6vF}+`-&-W8vy^OCxm3_{02royjvmwjlp+eQDzFVEUiyO#gLv%QdDSI#3W* z?3!lL8clTaNo-DVJw@ynq?q!%6hTQi35&^>P85G$TqNt78%9_sSJt2RThO|JzM$iL zg|wjxdMC2|Icc5rX*qPL(coL!u>-xxz-rFiC!6hD1IR%|HSRsV3>Kq~&vJ=s3M5y8SG%YBQ|{^l#LGlg!D?E>2yR*eV%9m$_J6VGQ~AIh&P$_aFbh zULr0Z$QE!QpkP=aAeR4ny<#3Fwyw@rZf4?Ewq`;mCVv}xaz+3ni+}a=k~P+yaWt^L z@w67!DqVf7D%7XtXX5xBW;Co|HvQ8WR1k?r2cZD%U;2$bsM%u8{JUJ5Z0k= zZJARv^vFkmWx15CB=rb=D4${+#DVqy5$C%bf`!T0+epLJLnh1jwCdb*zuCL}eEFvE z{rO1%gxg>1!W(I!owu*mJZ0@6FM(?C+d*CeceZRW_4id*D9p5nzMY&{mWqrJomjIZ z97ZNnZ3_%Hx8dn;H>p8m7F#^2;T%yZ3H;a&N7tm=Lvs&lgJLW{V1@h&6Vy~!+Ffbb zv(n3+v)_D$}dqd!2>Y2B)#<+o}LH#%ogGi2-?xRIH)1!SD)u-L65B&bsJTC=LiaF+YOCif2dUX6uAA|#+vNR z>U+KQekVGon)Yi<93(d!(yw1h3&X0N(PxN2{%vn}cnV?rYw z$N^}_o!XUB!mckL`yO1rnUaI4wrOeQ(+&k?2mi47hzxSD`N#-byqd1IhEoh!PGq>t z_MRy{5B0eKY>;Ao3z$RUU7U+i?iX^&r739F)itdrTpAi-NN0=?^m%?{A9Ly2pVv>Lqs6moTP?T2-AHqFD-o_ znVr|7OAS#AEH}h8SRPQ@NGG47dO}l=t07__+iK8nHw^(AHx&Wb<%jPc$$jl6_p(b$ z)!pi(0fQodCHfM)KMEMUR&UID>}m^(!{C^U7sBDOA)$VThRCI0_+2=( zV8mMq0R(#z;C|7$m>$>`tX+T|xGt(+Y48@ZYu#z;0pCgYgmMVbFb!$?%yhZqP_nhn zy4<#3P1oQ#2b51NU1mGnHP$cf0j-YOgAA}A$QoL6JVLcmExs(kU{4z;PBHJD%_=0F z>+sQV`mzijSIT7xn%PiDKHOujX;n|M&qr1T@rOxTdxtZ!&u&3HHFLYD5$RLQ=heur zb>+AFokUVQeJy-#LP*^)spt{mb@Mqe=A~-4p0b+Bt|pZ+@CY+%x}9f}izU5;4&QFE zO1bhg&A4uC1)Zb67kuowWY4xbo&J=%yoXlFB)&$d*-}kjBu|w!^zbD1YPc0-#XTJr z)pm2RDy%J3jlqSMq|o%xGS$bPwn4AqitC6&e?pqWcjWPt{3I{>CBy;hg0Umh#c;hU3RhCUX=8aR>rmd` z7Orw(5tcM{|-^J?ZAA9KP|)X6n9$-kvr#j5YDecTM6n z&07(nD^qb8hpF0B^z^pQ*%5ePYkv&FabrlI61ntiVp!!C8y^}|<2xgAd#FY=8b*y( zuQOuvy2`Ii^`VBNJB&R!0{hABYX55ooCAJSSevl4RPqEGb)iy_0H}v@vFwFzD%>#I>)3PsouQ+_Kkbqy*kKdHdfkN7NBcq%V{x^fSxgXpg7$bF& zj!6AQbDY(1u#1_A#1UO9AxiZaCVN2F0wGXdY*g@x$ByvUA?ePdide0dmr#}udE%K| z3*k}Vv2Ew2u1FXBaVA6aerI36R&rzEZeDDCl5!t0J=ug6kuNZzH>3i_VN`%BsaVB3 zQYw|Xub_SGf{)F{$ZX5`Jc!X!;eybjP+o$I{Z^Hsj@D=E{MnnL+TbC@HEU2DjG{3-LDGIbq()U87x4eS;JXnSh;lRlJ z>EL3D>wHt-+wTjQF$fGyDO$>d+(fq@bPpLBS~xA~R=3JPbS{tzN(u~m#Po!?H;IYv zE;?8%^vle|%#oux(Lj!YzBKv+Fd}*Ur-dCBoX*t{KeNM*n~ZPYJ4NNKkI^MFbz9!v z4(Bvm*Kc!-$%VFEewYJKz-CQN{`2}KX4*CeJEs+Q(!kI%hN1!1P6iOq?ovz}X0IOi z)YfWpwW@pK08^69#wSyCZkX9?uZD?C^@rw^Y?gLS_xmFKkooyx$*^5#cPqntNTtSG zlP>XLMj2!VF^0k#ole7`-c~*~+_T5ls?x4)ah(j8vo_ zwb%S8qoaZqY0-$ZI+ViIA_1~~rAH7K_+yFS{0rT@eQtTAdz#8E5VpwnW!zJ_^{Utv zlW5Iar3V5t&H4D6A=>?mq;G92;1cg9a2sf;gY9pJDVKn$DYdQlvfXq}zz8#LyPGq@ z+`YUMD;^-6w&r-82JL7mA8&M~Pj@aK!m{0+^v<|t%APYf7`}jGEhdYLqsHW-Le9TL z_hZZ1gbrz7$f9^fAzVIP30^KIz!!#+DRLL+qMszvI_BpOSmjtl$hh;&UeM{ER@INV zcI}VbiVTPoN|iSna@=7XkP&-4#06C};8ajbxJ4Gcq8(vWv4*&X8bM^T$mBk75Q92j z1v&%a;OSKc8EIrodmIiw$lOES2hzGDcjjB`kEDfJe{r}yE6`eZL zEB`9u>Cl0IsQ+t}`-cx}{6jqcANucqIB>Qmga_&<+80E2Q|VHHQ$YlAt{6`Qu`HA3 z03s0-sSlwbvgi&_R8s={6<~M^pGvBNjKOa>tWenzS8s zR>L7R5aZ=mSU{f?ib4Grx$AeFvtO5N|D>9#)ChH#Fny2maHWHOf2G=#<9Myot#+4u zWVa6d^Vseq_0=#AYS(-m$Lp;*8nC_6jXIjEM`omUmtH@QDs3|G)i4j*#_?#UYVZvJ z?YjT-?!4Q{BNun;dKBWLEw2C-VeAz`%?A>p;)PL}TAZn5j~HK>v1W&anteARlE+~+ zj>c(F;?qO3pXBb|#OZdQnm<4xWmn~;DR5SDMxt0UK_F^&eD|KZ=O;tO3vy4@4h^;2 zUL~-z`-P1aOe?|ZC1BgVsL)2^J-&vIFI%q@40w0{jjEfeVl)i9(~bt2z#2Vm)p`V_ z1;6$Ae7=YXk#=Qkd24Y23t&GvRxaOoad~NbJ+6pxqzJ>FY#Td7@`N5xp!n(c!=RE& z&<<@^a$_Ys8jqz4|5Nk#FY$~|FPC0`*a5HH!|Gssa9=~66&xG9)|=pOOJ2KE5|YrR zw!w6K2aC=J$t?L-;}5hn6mHd%hC;p8P|Dgh6D>hGnXPgi;6r+eA=?f72y9(Cf_ho{ zH6#)uD&R=73^$$NE;5piWX2bzR67fQ)`b=85o0eOLGI4c-Tb@-KNi2pz=Ke@SDcPn za$AxXib84`!Sf;Z3B@TSo`Dz7GM5Kf(@PR>Ghzi=BBxK8wRp>YQoXm+iL>H*Jo9M3 z6w&E?BC8AFTFT&Tv8zf+m9<&S&%dIaZ)Aoqkak_$r-2{$d~0g2oLETx9Y`eOAf14QXEQw3tJne;fdzl@wV#TFXSLXM2428F-Q}t+n2g%vPRMUzYPvzQ9f# zu(liiJem9P*?0%V@RwA7F53r~|I!Ty)<*AsMX3J{_4&}{6pT%Tpw>)^|DJ)>gpS~1rNEh z0$D?uO8mG?H;2BwM5a*26^7YO$XjUm40XmBsb63MoR;bJh63J;OngS5sSI+o2HA;W zdZV#8pDpC9Oez&L8loZO)MClRz!_!WD&QRtQxnazhT%Vj6Wl4G11nUk8*vSeVab@N#oJ}`KyJv+8Mo@T1-pqZ1t|?cnaVOd;1(h9 z!$DrN=jcGsVYE-0-n?oCJ^4x)F}E;UaD-LZUIzcD?W^ficqJWM%QLy6QikrM1aKZC zi{?;oKwq^Vsr|&`i{jIphA8S6G4)$KGvpULjH%9u(Dq247;R#l&I0{IhcC|oBF*Al zvLo7Xte=C{aIt*otJD}BUq)|_pdR>{zBMT< z(^1RpZv*l*m*OV^8>9&asGBo8h*_4q*)-eCv*|Pq=XNGrZE)^(SF7^{QE_~4VDB(o zVcPA_!G+2CAtLbl+`=Q~9iW`4ZRLku!uB?;tWqVjB0lEOf}2RD7dJ=BExy=<9wkb- z9&7{XFA%n#JsHYN8t5d~=T~5DcW4$B%3M+nNvC2`0!#@sckqlzo5;hhGi(D9=*A4` z5ynobawSPRtWn&CDLEs3Xf`(8^zDP=NdF~F^s&={l7(aw&EG}KWpMjtmz7j_VLO;@ zM2NVLDxZ@GIv7*gzl1 zjq78tv*8#WSY`}Su0&C;2F$Ze(q>F(@Wm^Gw!)(j;dk9Ad{STaxn)IV9FZhm*n+U} zi;4y*3v%A`_c7a__DJ8D1b@dl0Std3F||4Wtvi)fCcBRh!X9$1x!_VzUh>*S5s!oq z;qd{J_r79EL2wIeiGAqFstWtkfIJpjVh%zFo*=55B9Zq~y0=^iqHWfQl@O!Ak;(o*m!pZqe9 z%U2oDOhR)BvW8&F70L;2TpkzIutIvNQaTjjs5V#8mV4!NQ}zN=i`i@WI1z0eN-iCS z;vL-Wxc^Vc_qK<5RPh(}*8dLT{~GzE{w2o$2kMFaEl&q zP{V=>&3kW7tWaK-Exy{~`v4J0U#OZBk{a9{&)&QG18L@6=bsZ1zC_d{{pKZ-Ey>I> z;8H0t4bwyQqgu4hmO`3|4K{R*5>qnQ&gOfdy?z`XD%e5+pTDzUt3`k^u~SaL&XMe= z9*h#kT(*Q9jO#w2Hd|Mr-%DV8i_1{J1MU~XJ3!WUplhXDYBpJH><0OU`**nIvPIof z|N8@I=wA)sf45SAvx||f?Z5uB$kz1qL3Ky_{%RPdP5iN-D2!p5scq}buuC00C@jom zhfGKm3|f?Z0iQ|K$Z~!`8{nmAS1r+fp6r#YDOS8V*;K&Gs7Lc&f^$RC66O|)28oh`NHy&vq zJh+hAw8+ybTB0@VhWN^0iiTnLsCWbS_y`^gs!LX!Lw{yE``!UVzrV24tP8o;I6-65 z1MUiHw^{bB15tmrVT*7-#sj6cs~z`wk52YQJ*TG{SE;KTm#Hf#a~|<(|ImHH17nNM z`Ub{+J3dMD!)mzC8b(2tZtokKW5pAwHa?NFiso~# z1*iaNh4lQ4TS)|@G)H4dZV@l*Vd;Rw;-;odDhW2&lJ%m@jz+Panv7LQm~2Js6rOW3 z0_&2cW^b^MYW3)@o;neZ<{B4c#m48dAl$GCc=$>ErDe|?y@z`$uq3xd(%aAsX)D%l z>y*SQ%My`yDP*zof|3@_w#cjaW_YW4BdA;#Glg1RQcJGY*CJ9`H{@|D+*e~*457kd z73p<%fB^PV!Ybw@)Dr%(ZJbX}xmCStCYv#K3O32ej{$9IzM^I{6FJ8!(=azt7RWf4 z7ib0UOPqN40X!wOnFOoddd8`!_IN~9O)#HRTyjfc#&MCZ zZAMzOVB=;qwt8gV?{Y2?b=iSZG~RF~uyx18K)IDFLl})G1v@$(s{O4@RJ%OTJyF+Cpcx4jmy|F3euCnMK!P2WTDu5j z{{gD$=M*pH!GGzL%P)V2*ROm>!$Y=z|D`!_yY6e7SU$~a5q8?hZGgaYqaiLnkK%?0 zs#oI%;zOxF@g*@(V4p!$7dS1rOr6GVs6uYCTt2h)eB4?(&w8{#o)s#%gN@BBosRUe z)@P@8_Zm89pr~)b>e{tbPC~&_MR--iB{=)y;INU5#)@Gix-YpgP<-c2Ms{9zuCX|3 z!p(?VaXww&(w&uBHzoT%!A2=3HAP>SDxcljrego7rY|%hxy3XlODWffO_%g|l+7Y_ zqV(xbu)s4lV=l7M;f>vJl{`6qBm>#ZeMA}kXb97Z)?R97EkoI?x6Lp0yu1Z>PS?2{ z0QQ(8D)|lc9CO3B~e(pQM&5(1y&y=e>C^X$`)_&XuaI!IgDTVqt31wX#n+@!a_A0ZQkA zCJ2@M_4Gb5MfCrm5UPggeyh)8 zO9?`B0J#rkoCx(R0I!ko_2?iO@|oRf1;3r+i)w-2&j?=;NVIdPFsB)`|IC0zk6r9c zRrkfxWsiJ(#8QndNJj@{@WP2Ackr|r1VxV{7S&rSU(^)-M8gV>@UzOLXu9K<{6e{T zXJ6b92r$!|lwjhmgqkdswY&}c)KW4A)-ac%sU;2^fvq7gfUW4Bw$b!i@duy1CAxSn z(pyh$^Z=&O-q<{bZUP+$U}=*#M9uVc>CQVgDs4swy5&8RAHZ~$)hrTF4W zPsSa~qYv_0mJnF89RnnJTH`3}w4?~epFl=D(35$ zWa07ON$`OMBOHgCmfO(9RFc<)?$x)N}Jd2A(<*Ll7+4jrRt9w zwGxExUXd9VB#I|DwfxvJ;HZ8Q{37^wDhaZ%O!oO(HpcqfLH%#a#!~;Jl7F5>EX_=8 z{()l2NqPz>La3qJR;_v+wlK>GsHl;uRA8%j`A|yH@k5r%55S9{*Cp%uw6t`qc1!*T za2OeqtQj7sAp#Q~=5Fs&aCR9v>5V+s&RdNvo&H~6FJOjvaj--2sYYBvMq;55%z8^o z|BJDA4vzfow#DO#ZQHh;Oq_{r+qP{R9ox2TOgwQiv7Ow!zjN+A@BN;0tA2lUb#+zO z(^b89eV)D7UVE+h{mcNc6&GtpOqDn_?VAQ)Vob$hlFwW%xh>D#wml{t&Ofmm_d_+; zKDxzdr}`n2Rw`DtyIjrG)eD0vut$}dJAZ0AohZ+ZQdWXn_Z@dI_y=7t3q8x#pDI-K z2VVc&EGq445Rq-j0=U=Zx`oBaBjsefY;%)Co>J3v4l8V(T8H?49_@;K6q#r~Wwppc z4XW0(4k}cP=5ex>-Xt3oATZ~bBWKv)aw|I|Lx=9C1s~&b77idz({&q3T(Y(KbWO?+ zmcZ6?WeUsGk6>km*~234YC+2e6Zxdl~<_g2J|IE`GH%n<%PRv-50; zH{tnVts*S5*_RxFT9eM0z-pksIb^drUq4>QSww=u;UFCv2AhOuXE*V4z?MM`|ABOC4P;OfhS(M{1|c%QZ=!%rQTDFx`+}?Kdx$&FU?Y<$x;j7z=(;Lyz+?EE>ov!8vvMtSzG!nMie zsBa9t8as#2nH}n8xzN%W%U$#MHNXmDUVr@GX{?(=yI=4vks|V)!-W5jHsU|h_&+kY zS_8^kd3jlYqOoiI`ZqBVY!(UfnAGny!FowZWY_@YR0z!nG7m{{)4OS$q&YDyw6vC$ zm4!$h>*|!2LbMbxS+VM6&DIrL*X4DeMO!@#EzMVfr)e4Tagn~AQHIU8?e61TuhcKD zr!F4(kEebk(Wdk-?4oXM(rJwanS>Jc%<>R(siF+>+5*CqJLecP_we33iTFTXr6W^G z7M?LPC-qFHK;E!fxCP)`8rkxZyFk{EV;G-|kwf4b$c1k0atD?85+|4V%YATWMG|?K zLyLrws36p%Qz6{}>7b>)$pe>mR+=IWuGrX{3ZPZXF3plvuv5Huax86}KX*lbPVr}L z{C#lDjdDeHr~?l|)Vp_}T|%$qF&q#U;ClHEPVuS+Jg~NjC1RP=17=aQKGOcJ6B3mp z8?4*-fAD~}sX*=E6!}^u8)+m2j<&FSW%pYr_d|p_{28DZ#Cz0@NF=gC-o$MY?8Ca8 zr5Y8DSR^*urS~rhpX^05r30Ik#2>*dIOGxRm0#0YX@YQ%Mg5b6dXlS!4{7O_kdaW8PFSdj1=ryI-=5$fiieGK{LZ+SX(1b=MNL!q#lN zv98?fqqTUH8r8C7v(cx#BQ5P9W>- zmW93;eH6T`vuJ~rqtIBg%A6>q>gnWb3X!r0wh_q;211+Om&?nvYzL1hhtjB zK_7G3!n7PL>d!kj){HQE zE8(%J%dWLh1_k%gVXTZt zEdT09XSKAx27Ncaq|(vzL3gm83q>6CAw<$fTnMU05*xAe&rDfCiu`u^1)CD<>sx0i z*hr^N_TeN89G(nunZoLBf^81#pmM}>JgD@Nn1l*lN#a=B=9pN%tmvYFjFIoKe_(GF z-26x{(KXdfsQL7Uv6UtDuYwV`;8V3w>oT_I<`Ccz3QqK9tYT5ZQzbop{=I=!pMOCb zCU68`n?^DT%^&m>A%+-~#lvF!7`L7a{z<3JqIlk1$<||_J}vW1U9Y&eX<}l8##6i( zZcTT@2`9(Mecptm@{3A_Y(X`w9K0EwtPq~O!16bq{7c0f7#(3wn-^)h zxV&M~iiF!{-6A@>o;$RzQ5A50kxXYj!tcgme=Qjrbje~;5X2xryU;vH|6bE(8z^<7 zQ>BG7_c*JG8~K7Oe68i#0~C$v?-t@~@r3t2inUnLT(c=URpA9kA8uq9PKU(Ps(LVH zqgcqW>Gm?6oV#AldDPKVRcEyQIdTT`Qa1j~vS{<;SwyTdr&3*t?J)y=M7q*CzucZ&B0M=joT zBbj@*SY;o2^_h*>R0e({!QHF0=)0hOj^B^d*m>SnRrwq>MolNSgl^~r8GR#mDWGYEIJA8B<|{{j?-7p zVnV$zancW3&JVDtVpIlI|5djKq0(w$KxEFzEiiL=h5Jw~4Le23@s(mYyXWL9SX6Ot zmb)sZaly_P%BeX_9 zw&{yBef8tFm+%=--m*J|o~+Xg3N+$IH)t)=fqD+|fEk4AAZ&!wcN5=mi~Vvo^i`}> z#_3ahR}Ju)(Px7kev#JGcSwPXJ2id9%Qd2A#Uc@t8~egZ8;iC{e! z%=CGJOD1}j!HW_sgbi_8suYnn4#Ou}%9u)dXd3huFIb!ytlX>Denx@pCS-Nj$`VO&j@(z!kKSP0hE4;YIP#w9ta=3DO$7f*x zc9M4&NK%IrVmZAe=r@skWD`AEWH=g+r|*13Ss$+{c_R!b?>?UaGXlw*8qDmY#xlR= z<0XFbs2t?8i^G~m?b|!Hal^ZjRjt<@a? z%({Gn14b4-a|#uY^=@iiKH+k?~~wTj5K1A&hU z2^9-HTC)7zpoWK|$JXaBL6C z#qSNYtY>65T@Zs&-0cHeu|RX(Pxz6vTITdzJdYippF zC-EB+n4}#lM7`2Ry~SO>FxhKboIAF#Z{1wqxaCb{#yEFhLuX;Rx(Lz%T`Xo1+a2M}7D+@wol2)OJs$TwtRNJ={( zD@#zTUEE}#Fz#&(EoD|SV#bayvr&E0vzmb%H?o~46|FAcx?r4$N z&67W3mdip-T1RIxwSm_&(%U|+WvtGBj*}t69XVd&ebn>KOuL(7Y8cV?THd-(+9>G7*Nt%T zcH;`p={`SOjaf7hNd(=37Lz3-51;58JffzIPgGs_7xIOsB5p2t&@v1mKS$2D$*GQ6 zM(IR*j4{nri7NMK9xlDy-hJW6sW|ZiDRaFiayj%;(%51DN!ZCCCXz+0Vm#};70nOx zJ#yA0P3p^1DED;jGdPbQWo0WATN=&2(QybbVdhd=Vq*liDk`c7iZ?*AKEYC#SY&2g z&Q(Ci)MJ{mEat$ZdSwTjf6h~roanYh2?9j$CF@4hjj_f35kTKuGHvIs9}Re@iKMxS-OI*`0S z6s)fOtz}O$T?PLFVSeOjSO26$@u`e<>k(OSP!&YstH3ANh>)mzmKGNOwOawq-MPXe zy4xbeUAl6tamnx))-`Gi2uV5>9n(73yS)Ukma4*7fI8PaEwa)dWHs6QA6>$}7?(L8 ztN8M}?{Tf!Zu22J5?2@95&rQ|F7=FK-hihT-vDp!5JCcWrVogEnp;CHenAZ)+E+K5 z$Cffk5sNwD_?4+ymgcHR(5xgt20Z8M`2*;MzOM#>yhk{r3x=EyM226wb&!+j`W<%* zSc&|`8!>dn9D@!pYow~(DsY_naSx7(Z4i>cu#hA5=;IuI88}7f%)bRkuY2B;+9Uep zpXcvFWkJ!mQai63BgNXG26$5kyhZ2&*3Q_tk)Ii4M>@p~_~q_cE!|^A;_MHB;7s#9 zKzMzK{lIxotjc};k67^Xsl-gS!^*m*m6kn|sbdun`O?dUkJ{0cmI0-_2y=lTAfn*Y zKg*A-2sJq)CCJgY0LF-VQvl&6HIXZyxo2#!O&6fOhbHXC?%1cMc6y^*dOS{f$=137Ds1m01qs`>iUQ49JijsaQ( zksqV9@&?il$|4Ua%4!O15>Zy&%gBY&wgqB>XA3!EldQ%1CRSM(pp#k~-pkcCg4LAT zXE=puHbgsw)!xtc@P4r~Z}nTF=D2~j(6D%gTBw$(`Fc=OOQ0kiW$_RDd=hcO0t97h zb86S5r=>(@VGy1&#S$Kg_H@7G^;8Ue)X5Y+IWUi`o;mpvoV)`fcVk4FpcT|;EG!;? zHG^zrVVZOm>1KFaHlaogcWj(v!S)O(Aa|Vo?S|P z5|6b{qkH(USa*Z7-y_Uvty_Z1|B{rTS^qmEMLEYUSk03_Fg&!O3BMo{b^*`3SHvl0 zhnLTe^_vVIdcSHe)SQE}r~2dq)VZJ!aSKR?RS<(9lzkYo&dQ?mubnWmgMM37Nudwo z3Vz@R{=m2gENUE3V4NbIzAA$H1z0pagz94-PTJyX{b$yndsdKptmlKQKaaHj@3=ED zc7L?p@%ui|RegVYutK$64q4pe9+5sv34QUpo)u{1ci?)_7gXQd{PL>b0l(LI#rJmN zGuO+%GO`xneFOOr4EU(Wg}_%bhzUf;d@TU+V*2#}!2OLwg~%D;1FAu=Un>OgjPb3S z7l(riiCwgghC=Lm5hWGf5NdGp#01xQ59`HJcLXbUR3&n%P(+W2q$h2Qd z*6+-QXJ*&Kvk9ht0f0*rO_|FMBALen{j7T1l%=Q>gf#kma zQlg#I9+HB+z*5BMxdesMND`_W;q5|FaEURFk|~&{@qY32N$G$2B=&Po{=!)x5b!#n zxLzblkq{yj05#O7(GRuT39(06FJlalyv<#K4m}+vs>9@q-&31@1(QBv82{}Zkns~K ze{eHC_RDX0#^A*JQTwF`a=IkE6Ze@j#-8Q`tTT?k9`^ZhA~3eCZJ-Jr{~7Cx;H4A3 zcZ+Zj{mzFZbVvQ6U~n>$U2ZotGsERZ@}VKrgGh0xM;Jzt29%TX6_&CWzg+YYMozrM z`nutuS)_0dCM8UVaKRj804J4i%z2BA_8A4OJRQ$N(P9Mfn-gF;4#q788C@9XR0O3< zsoS4wIoyt046d+LnSCJOy@B@Uz*#GGd#+Ln1ek5Dv>(ZtD@tgZlPnZZJGBLr^JK+!$$?A_fA3LOrkoDRH&l7 zcMcD$Hsjko3`-{bn)jPL6E9Ds{WskMrivsUu5apD z?grQO@W7i5+%X&E&p|RBaEZ(sGLR@~(y^BI@lDMot^Ll?!`90KT!JXUhYS`ZgX3jnu@Ja^seA*M5R@f`=`ynQV4rc$uT1mvE?@tz)TN<=&H1%Z?5yjxcpO+6y_R z6EPuPKM5uxKpmZfT(WKjRRNHs@ib)F5WAP7QCADvmCSD#hPz$V10wiD&{NXyEwx5S z6NE`3z!IS^$s7m}PCwQutVQ#~w+V z=+~->DI*bR2j0^@dMr9`p>q^Ny~NrAVxrJtX2DUveic5vM%#N*XO|?YAWwNI$Q)_) zvE|L(L1jP@F%gOGtnlXtIv2&1i8q<)Xfz8O3G^Ea~e*HJsQgBxWL(yuLY+jqUK zRE~`-zklrGog(X}$9@ZVUw!8*=l`6mzYLtsg`AvBYz(cxmAhr^j0~(rzXdiOEeu_p zE$sf2(w(BPAvO5DlaN&uQ$4@p-b?fRs}d7&2UQ4Fh?1Hzu*YVjcndqJLw0#q@fR4u zJCJ}>_7-|QbvOfylj+e^_L`5Ep9gqd>XI3-O?Wp z-gt*P29f$Tx(mtS`0d05nHH=gm~Po_^OxxUwV294BDKT>PHVlC5bndncxGR!n(OOm znsNt@Q&N{TLrmsoKFw0&_M9$&+C24`sIXGWgQaz=kY;S{?w`z^Q0JXXBKFLj0w0U6P*+jPKyZHX9F#b0D1$&(- zrm8PJd?+SrVf^JlfTM^qGDK&-p2Kdfg?f>^%>1n8bu&byH(huaocL>l@f%c*QkX2i znl}VZ4R1en4S&Bcqw?$=Zi7ohqB$Jw9x`aM#>pHc0x z0$!q7iFu zZ`tryM70qBI6JWWTF9EjgG@>6SRzsd}3h+4D8d~@CR07P$LJ}MFsYi-*O%XVvD@yT|rJ+Mk zDllJ7$n0V&A!0flbOf)HE6P_afPWZmbhpliqJuw=-h+r;WGk|ntkWN(8tKlYpq5Ow z(@%s>IN8nHRaYb*^d;M(D$zGCv5C|uqmsDjwy4g=Lz>*OhO3z=)VD}C<65;`89Ye} zSCxrv#ILzIpEx1KdLPlM&%Cctf@FqTKvNPXC&`*H9=l=D3r!GLM?UV zOxa(8ZsB`&+76S-_xuj?G#wXBfDY@Z_tMpXJS7^mp z@YX&u0jYw2A+Z+bD#6sgVK5ZgdPSJV3>{K^4~%HV?rn~4D)*2H!67Y>0aOmzup`{D zzDp3c9yEbGCY$U<8biJ_gB*`jluz1ShUd!QUIQJ$*1;MXCMApJ^m*Fiv88RZ zFopLViw}{$Tyhh_{MLGIE2~sZ)t0VvoW%=8qKZ>h=adTe3QM$&$PO2lfqH@brt!9j ziePM8$!CgE9iz6B<6_wyTQj?qYa;eC^{x_0wuwV~W+^fZmFco-o%wsKSnjXFEx02V zF5C2t)T6Gw$Kf^_c;Ei3G~uC8SM-xyycmXyC2hAVi-IfXqhu$$-C=*|X?R0~hu z8`J6TdgflslhrmDZq1f?GXF7*ALeMmOEpRDg(s*H`4>_NAr`2uqF;k;JQ+8>A|_6ZNsNLECC%NNEb1Y1dP zbIEmNpK)#XagtL4R6BC{C5T(+=yA-(Z|Ap}U-AfZM#gwVpus3(gPn}Q$CExObJ5AC z)ff9Yk?wZ}dZ-^)?cbb9Fw#EjqQ8jxF4G3=L?Ra zg_)0QDMV1y^A^>HRI$x?Op@t;oj&H@1xt4SZ9(kifQ zb59B*`M99Td7@aZ3UWvj1rD0sE)d=BsBuW*KwkCds7ay(7*01_+L}b~7)VHI>F_!{ zyxg-&nCO?v#KOUec0{OOKy+sjWA;8rTE|Lv6I9H?CI?H(mUm8VXGwU$49LGpz&{nQp2}dinE1@lZ1iox6{ghN&v^GZv9J${7WaXj)<0S4g_uiJ&JCZ zr8-hsu`U%N;+9N^@&Q0^kVPB3)wY(rr}p7{p0qFHb3NUUHJb672+wRZs`gd1UjKPX z4o6zljKKA+Kkj?H>Ew63o%QjyBk&1!P22;MkD>sM0=z_s-G{mTixJCT9@_|*(p^bz zJ8?ZZ&;pzV+7#6Mn`_U-)k8Pjg?a;|Oe^us^PoPY$Va~yi8|?+&=y$f+lABT<*pZr zP}D{~Pq1Qyni+@|aP;ixO~mbEW9#c0OU#YbDZIaw=_&$K%Ep2f%hO^&P67hApZe`x zv8b`Mz@?M_7-)b!lkQKk)JXXUuT|B8kJlvqRmRpxtQDgvrHMXC1B$M@Y%Me!BSx3P z#2Eawl$HleZhhTS6Txm>lN_+I`>eV$&v9fOg)%zVn3O5mI*lAl>QcHuW6!Kixmq`X zBCZ*Ck6OYtDiK!N47>jxI&O2a9x7M|i^IagRr-fmrmikEQGgw%J7bO|)*$2FW95O4 zeBs>KR)izRG1gRVL;F*sr8A}aRHO0gc$$j&ds8CIO1=Gwq1%_~E)CWNn9pCtBE}+`Jelk4{>S)M)`Ll=!~gnn1yq^EX(+y*ik@3Ou0qU`IgYi3*doM+5&dU!cho$pZ zn%lhKeZkS72P?Cf68<#kll_6OAO26bIbueZx**j6o;I0cS^XiL`y+>{cD}gd%lux} z)3N>MaE24WBZ}s0ApfdM;5J_Ny}rfUyxfkC``Awo2#sgLnGPewK};dORuT?@I6(5~ z?kE)Qh$L&fwJXzK){iYx!l5$Tt|^D~MkGZPA}(o6f7w~O2G6Vvzdo*a;iXzk$B66$ zwF#;wM7A+(;uFG4+UAY(2`*3XXx|V$K8AYu#ECJYSl@S=uZW$ksfC$~qrrbQj4??z-)uz0QL}>k^?fPnJTPw% zGz)~?B4}u0CzOf@l^um}HZzbaIwPmb<)< zi_3@E9lc)Qe2_`*Z^HH;1CXOceL=CHpHS{HySy3T%<^NrWQ}G0i4e1xm_K3(+~oi$ zoHl9wzb?Z4j#90DtURtjtgvi7uw8DzHYmtPb;?%8vb9n@bszT=1qr)V_>R%s!92_` zfnHQPANx z<#hIjIMm#*(v*!OXtF+w8kLu`o?VZ5k7{`vw{Yc^qYclpUGIM_PBN1+c{#Vxv&E*@ zxg=W2W~JuV{IuRYw3>LSI1)a!thID@R=bU+cU@DbR^_SXY`MC7HOsCN z!dO4OKV7(E_Z8T#8MA1H`99?Z!r0)qKW_#|29X3#Jb+5+>qUidbeP1NJ@)(qi2S-X zao|f0_tl(O+$R|Qwd$H{_ig|~I1fbp_$NkI!0E;Y z6JrnU{1Ra6^on{9gUUB0mwzP3S%B#h0fjo>JvV~#+X0P~JV=IG=yHG$O+p5O3NUgG zEQ}z6BTp^Fie)Sg<){Z&I8NwPR(=mO4joTLHkJ>|Tnk23E(Bo`FSbPc05lF2-+)X? z6vV3*m~IBHTy*^E!<0nA(tCOJW2G4DsH7)BxLV8kICn5lu6@U*R`w)o9;Ro$i8=Q^V%uH8n3q=+Yf;SFRZu z!+F&PKcH#8cG?aSK_Tl@K9P#8o+jry@gdexz&d(Q=47<7nw@e@FFfIRNL9^)1i@;A z28+$Z#rjv-wj#heI|<&J_DiJ*s}xd-f!{J8jfqOHE`TiHHZVIA8CjkNQ_u;Ery^^t zl1I75&u^`1_q)crO+JT4rx|z2ToSC>)Or@-D zy3S>jW*sNIZR-EBsfyaJ+Jq4BQE4?SePtD2+jY8*%FsSLZ9MY>+wk?}}}AFAw)vr{ml)8LUG-y9>^t!{~|sgpxYc0Gnkg`&~R z-pilJZjr@y5$>B=VMdZ73svct%##v%wdX~9fz6i3Q-zOKJ9wso+h?VME7}SjL=!NUG{J?M&i!>ma`eoEa@IX`5G>B1(7;%}M*%-# zfhJ(W{y;>MRz!Ic8=S}VaBKqh;~7KdnGEHxcL$kA-6E~=!hrN*zw9N+_=odt<$_H_8dbo;0=42wcAETPCVGUr~v(`Uai zb{=D!Qc!dOEU6v)2eHSZq%5iqK?B(JlCq%T6av$Cb4Rko6onlG&?CqaX7Y_C_cOC3 zYZ;_oI(}=>_07}Oep&Ws7x7-R)cc8zfe!SYxJYP``pi$FDS)4Fvw5HH=FiU6xfVqIM!hJ;Rx8c0cB7~aPtNH(Nmm5Vh{ibAoU#J6 zImRCr?(iyu_4W_6AWo3*vxTPUw@vPwy@E0`(>1Qi=%>5eSIrp^`` zK*Y?fK_6F1W>-7UsB)RPC4>>Ps9)f+^MqM}8AUm@tZ->j%&h1M8s*s!LX5&WxQcAh z8mciQej@RPm?660%>{_D+7er>%zX_{s|$Z+;G7_sfNfBgY(zLB4Ey}J9F>zX#K0f6 z?dVNIeEh?EIShmP6>M+d|0wMM85Sa4diw1hrg|ITJ}JDg@o8y>(rF9mXk5M z2@D|NA)-7>wD&wF;S_$KS=eE84`BGw3g0?6wGxu8ys4rwI?9U=*^VF22t3%mbGeOh z`!O-OpF7#Vceu~F`${bW0nYVU9ecmk31V{tF%iv&5hWofC>I~cqAt@u6|R+|HLMMX zVxuSlMFOK_EQ86#E8&KwxIr8S9tj_goWtLv4f@!&h8;Ov41{J~496vp9vX=(LK#j! zAwi*21RAV-LD>9Cw3bV_9X(X3)Kr0-UaB*7Y>t82EQ%!)(&(XuAYtTsYy-dz+w=$ir)VJpe!_$ z6SGpX^i(af3{o=VlFPC);|J8#(=_8#vdxDe|Cok+ANhYwbE*FO`Su2m1~w+&9<_9~ z-|tTU_ACGN`~CNW5WYYBn^B#SwZ(t4%3aPp z;o)|L6Rk569KGxFLUPx@!6OOa+5OjQLK5w&nAmwxkC5rZ|m&HT8G%GVZxB_@ME z>>{rnXUqyiJrT(8GMj_ap#yN_!9-lO5e8mR3cJiK3NE{_UM&=*vIU`YkiL$1%kf+1 z4=jk@7EEj`u(jy$HnzE33ZVW_J4bj}K;vT?T91YlO(|Y0FU4r+VdbmQ97%(J5 zkK*Bed8+C}FcZ@HIgdCMioV%A<*4pw_n}l*{Cr4}a(lq|injK#O?$tyvyE`S%(1`H z_wwRvk#13ElkZvij2MFGOj`fhy?nC^8`Zyo%yVcUAfEr8x&J#A{|moUBAV_^f$hpaUuyQeY3da^ zS9iRgf87YBwfe}>BO+T&Fl%rfpZh#+AM?Dq-k$Bq`vG6G_b4z%Kbd&v>qFjow*mBl z-OylnqOpLg}or7_VNwRg2za3VBK6FUfFX{|TD z`Wt0Vm2H$vdlRWYQJqDmM?JUbVqL*ZQY|5&sY*?!&%P8qhA~5+Af<{MaGo(dl&C5t zE%t!J0 zh6jqANt4ABdPxSTrVV}fLsRQal*)l&_*rFq(Ez}ClEH6LHv{J#v?+H-BZ2)Wy{K@9 z+ovXHq~DiDvm>O~r$LJo!cOuwL+Oa--6;UFE2q@g3N8Qkw5E>ytz^(&($!O47+i~$ zKM+tkAd-RbmP{s_rh+ugTD;lriL~`Xwkad#;_aM?nQ7L_muEFI}U_4$phjvYgleK~`Fo`;GiC07&Hq1F<%p;9Q;tv5b?*QnR%8DYJH3P>Svmv47Y>*LPZJy8_{9H`g6kQpyZU{oJ`m%&p~D=K#KpfoJ@ zn-3cqmHsdtN!f?~w+(t+I`*7GQA#EQC^lUA9(i6=i1PqSAc|ha91I%X&nXzjYaM{8$s&wEx@aVkQ6M{E2 zfzId#&r(XwUNtPcq4Ngze^+XaJA1EK-%&C9j>^9(secqe{}z>hR5CFNveMsVA)m#S zk)_%SidkY-XmMWlVnQ(mNJ>)ooszQ#vaK;!rPmGKXV7am^_F!Lz>;~{VrIO$;!#30XRhE1QqO_~#+Ux;B_D{Nk=grn z8Y0oR^4RqtcYM)7a%@B(XdbZCOqnX#fD{BQTeLvRHd(irHKq=4*jq34`6@VAQR8WG z^%)@5CXnD_T#f%@-l${>y$tfb>2LPmc{~5A82|16mH)R?&r#KKLs7xpN-D`=&Cm^R zvMA6#Ahr<3X>Q7|-qfTY)}32HkAz$_mibYV!I)u>bmjK`qwBe(>za^0Kt*HnFbSdO z1>+ryKCNxmm^)*$XfiDOF2|{-v3KKB?&!(S_Y=Ht@|ir^hLd978xuI&N{k>?(*f8H z=ClxVJK_%_z1TH0eUwm2J+2To7FK4o+n_na)&#VLn1m;!+CX+~WC+qg1?PA~KdOlC zW)C@pw75_xoe=w7i|r9KGIvQ$+3K?L{7TGHwrQM{dCp=Z*D}3kX7E-@sZnup!BImw z*T#a=+WcTwL78exTgBn|iNE3#EsOorO z*kt)gDzHiPt07fmisA2LWN?AymkdqTgr?=loT7z@d`wnlr6oN}@o|&JX!yPzC*Y8d zu6kWlTzE1)ckyBn+0Y^HMN+GA$wUO_LN6W>mxCo!0?oiQvT`z$jbSEu&{UHRU0E8# z%B^wOc@S!yhMT49Y)ww(Xta^8pmPCe@eI5C*ed96)AX9<>))nKx0(sci8gwob_1}4 z0DIL&vsJ1_s%<@y%U*-eX z5rN&(zef-5G~?@r79oZGW1d!WaTqQn0F6RIOa9tJ=0(kdd{d1{<*tHT#cCvl*i>YY zH+L7jq8xZNcTUBqj(S)ztTU!TM!RQ}In*n&Gn<>(60G7}4%WQL!o>hbJqNDSGwl#H z`4k+twp0cj%PsS+NKaxslAEu9!#U3xT1|_KB6`h=PI0SW`P9GTa7caD1}vKEglV8# zjKZR`pluCW19c2fM&ZG)c3T3Um;ir3y(tSCJ7Agl6|b524dy5El{^EQBG?E61H0XY z`bqg!;zhGhyMFl&(o=JWEJ8n~z)xI}A@C0d2hQGvw7nGv)?POU@(kS1m=%`|+^ika zXl8zjS?xqW$WlO?Ewa;vF~XbybHBor$f<%I&*t$F5fynwZlTGj|IjZtVfGa7l&tK} zW>I<69w(cZLu)QIVG|M2xzW@S+70NinQzk&Y0+3WT*cC)rx~04O-^<{JohU_&HL5XdUKW!uFy|i$FB|EMu0eUyW;gsf`XfIc!Z0V zeK&*hPL}f_cX=@iv>K%S5kL;cl_$v?n(Q9f_cChk8Lq$glT|=e+T*8O4H2n<=NGmn z+2*h+v;kBvF>}&0RDS>)B{1!_*XuE8A$Y=G8w^qGMtfudDBsD5>T5SB;Qo}fSkkiV ze^K^M(UthkwrD!&*tTsu>Dacdj_q`~V%r_twr$(Ct&_dKeeXE?fA&4&yASJWJ*}~- zel=@W)tusynfC_YqH4ll>4Eg`Xjs5F7Tj>tTLz<0N3)X<1px_d2yUY>X~y>>93*$) z5PuNMQLf9Bu?AAGO~a_|J2akO1M*@VYN^VxvP0F$2>;Zb9;d5Yfd8P%oFCCoZE$ z4#N$^J8rxYjUE_6{T%Y>MmWfHgScpuGv59#4u6fpTF%~KB^Ae`t1TD_^Ud#DhL+Dm zbY^VAM#MrAmFj{3-BpVSWph2b_Y6gCnCAombVa|1S@DU)2r9W<> zT5L8BB^er3zxKt1v(y&OYk!^aoQisqU zH(g@_o)D~BufUXcPt!Ydom)e|aW{XiMnes2z&rE?og>7|G+tp7&^;q?Qz5S5^yd$i z8lWr4g5nctBHtigX%0%XzIAB8U|T6&JsC4&^hZBw^*aIcuNO47de?|pGXJ4t}BB`L^d8tD`H`i zqrP8?#J@8T#;{^B!KO6J=@OWKhAerih(phML`(Rg7N1XWf1TN>=Z3Do{l_!d~DND&)O)D>ta20}@Lt77qSnVsA7>)uZAaT9bsB>u&aUQl+7GiY2|dAEg@%Al3i316y;&IhQL^8fw_nwS>f60M_-m+!5)S_6EPM7Y)(Nq^8gL7(3 zOiot`6Wy6%vw~a_H?1hLVzIT^i1;HedHgW9-P#)}Y6vF%C=P70X0Tk^z9Te@kPILI z_(gk!k+0%CG)%!WnBjjw*kAKs_lf#=5HXC00s-}oM-Q1aXYLj)(1d!_a7 z*Gg4Fe6F$*ujVjI|79Z5+Pr`us%zW@ln++2l+0hsngv<{mJ%?OfSo_3HJXOCys{Ug z00*YR-(fv<=&%Q!j%b-_ppA$JsTm^_L4x`$k{VpfLI(FMCap%LFAyq;#ns5bR7V+x zO!o;c5y~DyBPqdVQX)8G^G&jWkBy2|oWTw>)?5u}SAsI$RjT#)lTV&Rf8;>u*qXnb z8F%Xb=7#$m)83z%`E;49)t3fHInhtc#kx4wSLLms!*~Z$V?bTyUGiS&m>1P(952(H zuHdv=;o*{;5#X-uAyon`hP}d#U{uDlV?W?_5UjJvf%11hKwe&(&9_~{W)*y1nR5f_ z!N(R74nNK`y8>B!0Bt_Vr!;nc3W>~RiKtGSBkNlsR#-t^&;$W#)f9tTlZz>n*+Fjz z3zXZ;jf(sTM(oDzJt4FJS*8c&;PLTW(IQDFs_5QPy+7yhi1syPCarvqrHFcf&yTy)^O<1EBx;Ir`5W{TIM>{8w&PB>ro4;YD<5LF^TjTb0!zAP|QijA+1Vg>{Afv^% zmrkc4o6rvBI;Q8rj4*=AZacy*n8B{&G3VJc)so4$XUoie0)vr;qzPZVbb<#Fc=j+8CGBWe$n|3K& z_@%?{l|TzKSlUEO{U{{%Fz_pVDxs7i9H#bnbCw7@4DR=}r_qV!Zo~CvD4ZI*+j3kO zW6_=|S`)(*gM0Z;;}nj`73OigF4p6_NPZQ-Od~e$c_);;4-7sR>+2u$6m$Gf%T{aq zle>e3(*Rt(TPD}03n5)!Ca8Pu!V}m6v0o1;5<1h$*|7z|^(3$Y&;KHKTT}hV056wuF0Xo@mK-52~r=6^SI1NC%c~CC?n>yX6wPTgiWYVz!Sx^atLby9YNn1Rk{g?|pJaxD4|9cUf|V1_I*w zzxK)hRh9%zOl=*$?XUjly5z8?jPMy%vEN)f%T*|WO|bp5NWv@B(K3D6LMl!-6dQg0 zXNE&O>Oyf%K@`ngCvbGPR>HRg5!1IV$_}m@3dWB7x3t&KFyOJn9pxRXCAzFr&%37wXG;z^xaO$ekR=LJG ztIHpY8F5xBP{mtQidqNRoz= z@){+N3(VO5bD+VrmS^YjG@+JO{EOIW)9=F4v_$Ed8rZtHvjpiEp{r^c4F6Ic#ChlC zJX^DtSK+v(YdCW)^EFcs=XP7S>Y!4=xgmv>{S$~@h=xW-G4FF9?I@zYN$e5oF9g$# zb!eVU#J+NjLyX;yb)%SY)xJdvGhsnE*JEkuOVo^k5PyS=o#vq!KD46UTW_%R=Y&0G zFj6bV{`Y6)YoKgqnir2&+sl+i6foAn-**Zd1{_;Zb7Ki=u394C5J{l^H@XN`_6XTKY%X1AgQM6KycJ+= zYO=&t#5oSKB^pYhNdzPgH~aEGW2=ec1O#s-KG z71}LOg@4UEFtp3GY1PBemXpNs6UK-ax*)#$J^pC_me;Z$Je(OqLoh|ZrW*mAMBFn< zHttjwC&fkVfMnQeen8`Rvy^$pNRFVaiEN4Pih*Y3@jo!T0nsClN)pdrr9AYLcZxZ| zJ5Wlj+4q~($hbtuY zVQ7hl>4-+@6g1i`1a)rvtp-;b0>^`Dloy(#{z~ytgv=j4q^Kl}wD>K_Y!l~ zp(_&7sh`vfO(1*MO!B%<6E_bx1)&s+Ae`O)a|X=J9y~XDa@UB`m)`tSG4AUhoM=5& znWoHlA-(z@3n0=l{E)R-p8sB9XkV zZ#D8wietfHL?J5X0%&fGg@MH~(rNS2`GHS4xTo7L$>TPme+Is~!|79=^}QbPF>m%J zFMkGzSndiPO|E~hrhCeo@&Ea{M(ieIgRWMf)E}qeTxT8Q#g-!Lu*x$v8W^M^>?-g= zwMJ$dThI|~M06rG$Sv@C@tWR>_YgaG&!BAbkGggVQa#KdtDB)lMLNVLN|51C@F^y8 zCRvMB^{GO@j=cHfmy}_pCGbP%xb{pNN>? z?7tBz$1^zVaP|uaatYaIN+#xEN4jBzwZ|YI_)p(4CUAz1ZEbDk>J~Y|63SZaak~#0 zoYKruYsWHoOlC1(MhTnsdUOwQfz5p6-D0}4;DO$B;7#M{3lSE^jnTT;ns`>!G%i*F?@pR1JO{QTuD0U+~SlZxcc8~>IB{)@8p`P&+nDxNj`*gh|u?yrv$phpQcW)Us)bi`kT%qLj(fi{dWRZ%Es2!=3mI~UxiW0$-v3vUl?#g{p6eF zMEUAqo5-L0Ar(s{VlR9g=j7+lt!gP!UN2ICMokAZ5(Agd>})#gkA2w|5+<%-CuEP# zqgcM}u@3(QIC^Gx<2dbLj?cFSws_f3e%f4jeR?4M^M3cx1f+Qr6ydQ>n)kz1s##2w zk}UyQc+Z5G-d-1}{WzjkLXgS-2P7auWSJ%pSnD|Uivj5u!xk0 z_^-N9r9o;(rFDt~q1PvE#iJZ_f>J3gcP$)SOqhE~pD2|$=GvpL^d!r z6u=sp-CrMoF7;)}Zd7XO4XihC4ji?>V&(t^?@3Q&t9Mx=qex6C9d%{FE6dvU6%d94 zIE;hJ1J)cCqjv?F``7I*6bc#X)JW2b4f$L^>j{*$R`%5VHFi*+Q$2;nyieduE}qdS{L8y8F08yLs?w}{>8>$3236T-VMh@B zq-nujsb_1aUv_7g#)*rf9h%sFj*^mIcImRV*k~Vmw;%;YH(&ylYpy!&UjUVqqtfG` zox3esju?`unJJA_zKXRJP)rA3nXc$m^{S&-p|v|-0x9LHJm;XIww7C#R$?00l&Yyj z=e}gKUOpsImwW?N)+E(awoF@HyP^EhL+GlNB#k?R<2>95hz!h9sF@U20DHSB3~WMa zk90+858r@-+vWwkawJ)8ougd(i#1m3GLN{iSTylYz$brAsP%=&m$mQQrH$g%3-^VR zE%B`Vi&m8f3T~&myTEK28BDWCVzfWir1I?03;pX))|kY5ClO^+bae z*7E?g=3g7EiisYOrE+lA)2?Ln6q2*HLNpZEWMB|O-JI_oaHZB%CvYB(%=tU= zE*OY%QY58fW#RG5=gm0NR#iMB=EuNF@)%oZJ}nmm=tsJ?eGjia{e{yuU0l3{d^D@)kVDt=1PE)&tf_hHC%0MB znL|CRCPC}SeuVTdf>-QV70`0(EHizc21s^sU>y%hW0t!0&y<7}Wi-wGy>m%(-jsDj zP?mF|>p_K>liZ6ZP(w5(|9Ga%>tLgb$|doDDfkdW>Z z`)>V2XC?NJT26mL^@ zf+IKr27TfM!UbZ@?zRddC7#6ss1sw%CXJ4FWC+t3lHZupzM77m^=9 z&(a?-LxIq}*nvv)y?27lZ{j zifdl9hyJudyP2LpU$-kXctshbJDKS{WfulP5Dk~xU4Le4c#h^(YjJit4#R8_khheS z|8(>2ibaHES4+J|DBM7I#QF5u-*EdN{n=Kt@4Zt?@Tv{JZA{`4 zU#kYOv{#A&gGPwT+$Ud}AXlK3K7hYzo$(fBSFjrP{QQ zeaKg--L&jh$9N}`pu{Bs>?eDFPaWY4|9|foN%}i;3%;@4{dc+iw>m}{3rELqH21G! z`8@;w-zsJ1H(N3%|1B@#ioLOjib)j`EiJqPQVSbPSPVHCj6t5J&(NcWzBrzCiDt{4 zdlPAUKldz%6x5II1H_+jv)(xVL+a;P+-1hv_pM>gMRr%04@k;DTokASSKKhU1Qms| zrWh3a!b(J3n0>-tipg{a?UaKsP7?+|@A+1WPDiQIW1Sf@qDU~M_P65_s}7(gjTn0X zucyEm)o;f8UyshMy&>^SC3I|C6jR*R_GFwGranWZe*I>K+0k}pBuET&M~ z;Odo*ZcT?ZpduHyrf8E%IBFtv;JQ!N_m>!sV6ly$_1D{(&nO~w)G~Y`7sD3#hQk%^ zp}ucDF_$!6DAz*PM8yE(&~;%|=+h(Rn-=1Wykas_-@d&z#=S}rDf`4w(rVlcF&lF! z=1)M3YVz7orwk^BXhslJ8jR);sh^knJW(Qmm(QdSgIAIdlN4Te5KJisifjr?eB{FjAX1a0AB>d?qY4Wx>BZ8&}5K0fA+d{l8 z?^s&l8#j7pR&ijD?0b%;lL9l$P_mi2^*_OL+b}4kuLR$GAf85sOo02?Y#90}CCDiS zZ%rbCw>=H~CBO=C_JVV=xgDe%b4FaEFtuS7Q1##y686r%F6I)s-~2(}PWK|Z8M+Gu zl$y~5@#0Ka%$M<&Cv%L`a8X^@tY&T7<0|(6dNT=EsRe0%kp1Qyq!^43VAKYnr*A5~ zsI%lK1ewqO;0TpLrT9v}!@vJK{QoVa_+N4FYT#h?Y8rS1S&-G+m$FNMP?(8N`MZP zels(*?kK{{^g9DOzkuZXJ2;SrOQsp9T$hwRB1(phw1c7`!Q!by?Q#YsSM#I12RhU{$Q+{xj83axHcftEc$mNJ8_T7A-BQc*k(sZ+~NsO~xAA zxnbb%dam_fZlHvW7fKXrB~F&jS<4FD2FqY?VG?ix*r~MDXCE^WQ|W|WM;gsIA4lQP zJ2hAK@CF*3*VqPr2eeg6GzWFlICi8S>nO>5HvWzyZTE)hlkdC_>pBej*>o0EOHR|) z$?};&I4+_?wvL*g#PJ9)!bc#9BJu1(*RdNEn>#Oxta(VWeM40ola<0aOe2kSS~{^P zDJBd}0L-P#O-CzX*%+$#v;(x%<*SPgAje=F{Zh-@ucd2DA(yC|N_|ocs*|-!H%wEw z@Q!>siv2W;C^^j^59OAX03&}&D*W4EjCvfi(ygcL#~t8XGa#|NPO+*M@Y-)ctFA@I z-p7npT1#5zOLo>7q?aZpCZ=iecn3QYklP;gF0bq@>oyBq94f6C=;Csw3PkZ|5q=(c zfs`aw?II0e(h=|7o&T+hq&m$; zBrE09Twxd9BJ2P+QPN}*OdZ-JZV7%av@OM7v!!NL8R;%WFq*?{9T3{ct@2EKgc8h) zMxoM$SaF#p<`65BwIDfmXG6+OiK0e)`I=!A3E`+K@61f}0e z!2a*FOaDrOe>U`q%K!QN`&=&0C~)CaL3R4VY(NDt{Xz(Xpqru5=r#uQN1L$Je1*dkdqQ*=lofQaN%lO!<5z9ZlHgxt|`THd>2 zsWfU$9=p;yLyJyM^t zS2w9w?Bpto`@H^xJpZDKR1@~^30Il6oFGfk5%g6w*C+VM)+%R@gfIwNprOV5{F^M2 zO?n3DEzpT+EoSV-%OdvZvNF+pDd-ZVZ&d8 zKeIyrrfPN=EcFRCPEDCVflX#3-)Ik_HCkL(ejmY8vzcf-MTA{oHk!R2*36`O68$7J zf}zJC+bbQk--9Xm!u#lgLvx8TXx2J258E5^*IZ(FXMpq$2LUUvhWQPs((z1+2{Op% z?J}9k5^N=z;7ja~zi8a_-exIqWUBJwohe#4QJ`|FF*$C{lM18z^#hX6!5B8KAkLUX ziP=oti-gpV(BsLD{0(3*dw}4JxK23Y7M{BeFPucw!sHpY&l%Ws4pSm`+~V7;bZ%Dx zeI)MK=4vC&5#;2MT7fS?^ch9?2;%<8Jlu-IB&N~gg8t;6S-#C@!NU{`p7M8@2iGc& zg|JPg%@gCoCQ&s6JvDU&`X2S<57f(k8nJ1wvBu{8r?;q3_kpZZ${?|( z+^)UvR33sjSd)aT!UPkA;ylO6{aE3MQa{g%Mcf$1KONcjO@&g5zPHWtzM1rYC{_K> zgQNcs<{&X{OA=cEWw5JGqpr0O>x*Tfak2PE9?FuWtz^DDNI}rwAaT0(bdo-<+SJ6A z&}S%boGMWIS0L}=S>|-#kRX;e^sUsotry(MjE|3_9duvfc|nwF#NHuM-w7ZU!5ei8 z6Mkf>2)WunY2eU@C-Uj-A zG(z0Tz2YoBk>zCz_9-)4a>T46$(~kF+Y{#sA9MWH%5z#zNoz)sdXq7ZR_+`RZ%0(q zC7&GyS_|BGHNFl8Xa%@>iWh%Gr?=J5<(!OEjauj5jyrA-QXBjn0OAhJJ9+v=!LK`` z@g(`^*84Q4jcDL`OA&ZV60djgwG`|bcD*i50O}Q{9_noRg|~?dj%VtKOnyRs$Uzqg z191aWoR^rDX#@iSq0n z?9Sg$WSRPqSeI<}&n1T3!6%Wj@5iw5`*`Btni~G=&;J+4`7g#OQTa>u`{4ZZ(c@s$ zK0y;ySOGD-UTjREKbru{QaS>HjN<2)R%Nn-TZiQ(Twe4p@-saNa3~p{?^V9Nixz@a zykPv~<@lu6-Ng9i$Lrk(xi2Tri3q=RW`BJYOPC;S0Yly%77c727Yj-d1vF!Fuk{Xh z)lMbA69y7*5ufET>P*gXQrxsW+ zz)*MbHZv*eJPEXYE<6g6_M7N%#%mR{#awV3i^PafNv(zyI)&bH?F}2s8_rR(6%!V4SOWlup`TKAb@ee>!9JKPM=&8g#BeYRH9FpFybxBXQI2|g}FGJfJ+ zY-*2hB?o{TVL;Wt_ek;AP5PBqfDR4@Z->_182W z{P@Mc27j6jE*9xG{R$>6_;i=y{qf(c`5w9fa*`rEzX6t!KJ(p1H|>J1pC-2zqWENF zmm=Z5B4u{cY2XYl(PfrInB*~WGWik3@1oRhiMOS|D;acnf-Bs(QCm#wR;@Vf!hOPJ zgjhDCfDj$HcyVLJ=AaTbQ{@vIv14LWWF$=i-BDoC11}V;2V8A`S>_x)vIq44-VB-v z*w-d}$G+Ql?En8j!~ZkCpQ$|cA0|+rrY>tiCeWxkRGPoarxlGU2?7%k#F693RHT24 z-?JsiXlT2PTqZqNb&sSc>$d;O4V@|b6VKSWQb~bUaWn1Cf0+K%`Q&Wc<>mQ>*iEGB zbZ;aYOotBZ{vH3y<0A*L0QVM|#rf*LIsGx(O*-7)r@yyBIzJnBFSKBUSl1e|8lxU* zzFL+YDVVkIuzFWeJ8AbgN&w(4-7zbiaMn{5!JQXu)SELk*CNL+Fro|2v|YO)1l15t zs(0^&EB6DPMyaqvY>=KL>)tEpsn;N5Q#yJj<9}ImL((SqErWN3Q=;tBO~ExTCs9hB z2E$7eN#5wX4<3m^5pdjm#5o>s#eS_Q^P)tm$@SawTqF*1dj_i#)3};JslbLKHXl_N z)Fxzf>FN)EK&Rz&*|6&%Hs-^f{V|+_vL1S;-1K-l$5xiC@}%uDuwHYhmsV?YcOUlk zOYkG5v2+`+UWqpn0aaaqrD3lYdh0*!L`3FAsNKu=Q!vJu?Yc8n|CoYyDo_`r0mPoo z8>XCo$W4>l(==h?2~PoRR*kEe)&IH{1sM41mO#-36`02m#nTX{r*r`Q5rZ2-sE|nA zhnn5T#s#v`52T5|?GNS`%HgS2;R(*|^egNPDzzH_z^W)-Q98~$#YAe)cEZ%vge965AS_am#DK#pjPRr-!^za8>`kksCAUj(Xr*1NW5~e zpypt_eJpD&4_bl_y?G%>^L}=>xAaV>KR6;^aBytqpiHe%!j;&MzI_>Sx7O%F%D*8s zSN}cS^<{iiK)=Ji`FpO#^zY!_|D)qeRNAtgmH)m;qC|mq^j(|hL`7uBz+ULUj37gj zksdbnU+LSVo35riSX_4z{UX=%n&}7s0{WuZYoSfwAP`8aKN9P@%e=~1`~1ASL-z%# zw>DO&ixr}c9%4InGc*_y42bdEk)ZdG7-mTu0bD@_vGAr*NcFoMW;@r?@LUhRI zCUJgHb`O?M3!w)|CPu~ej%fddw20lod?Ufp8Dmt0PbnA0J%KE^2~AIcnKP()025V> zG>noSM3$5Btmc$GZoyP^v1@Poz0FD(6YSTH@aD0}BXva?LphAiSz9f&Y(aDAzBnUh z?d2m``~{z;{}kZJ>a^wYI?ry(V9hIoh;|EFc0*-#*`$T0DRQ1;WsqInG;YPS+I4{g zJGpKk%%Sdc5xBa$Q^_I~(F97eqDO7AN3EN0u)PNBAb+n+ zWBTxQx^;O9o0`=g+Zrt_{lP!sgWZHW?8bLYS$;1a@&7w9rD9|Ge;Gb?sEjFoF9-6v z#!2)t{DMHZ2@0W*fCx;62d#;jouz`R5Y(t{BT=$N4yr^^o$ON8d{PQ=!O zX17^CrdM~7D-;ZrC!||<+FEOxI_WI3CA<35va%4v>gc zEX-@h8esj=a4szW7x{0g$hwoWRQG$yK{@3mqd-jYiVofJE!Wok1* znV7Gm&Ssq#hFuvj1sRyHg(6PFA5U*Q8Rx>-blOs=lb`qa{zFy&n4xY;sd$fE+<3EI z##W$P9M{B3c3Si9gw^jlPU-JqD~Cye;wr=XkV7BSv#6}DrsXWFJ3eUNrc%7{=^sP> zrp)BWKA9<}^R9g!0q7yWlh;gr_TEOD|#BmGq<@IV;ueg+D2}cjpp+dPf&Q(36sFU&K8}hA85U61faW&{ zlB`9HUl-WWCG|<1XANN3JVAkRYvr5U4q6;!G*MTdSUt*Mi=z_y3B1A9j-@aK{lNvx zK%p23>M&=KTCgR!Ee8c?DAO2_R?B zkaqr6^BSP!8dHXxj%N1l+V$_%vzHjqvu7p@%Nl6;>y*S}M!B=pz=aqUV#`;h%M0rU zHfcog>kv3UZAEB*g7Er@t6CF8kHDmKTjO@rejA^ULqn!`LwrEwOVmHx^;g|5PHm#B zZ+jjWgjJ!043F+&#_;D*mz%Q60=L9Ove|$gU&~As5^uz@2-BfQ!bW)Khn}G+Wyjw- z19qI#oB(RSNydn0t~;tAmK!P-d{b-@@E5|cdgOS#!>%#Rj6ynkMvaW@37E>@hJP^8 z2zk8VXx|>#R^JCcWdBCy{0nPmYFOxN55#^-rlqobe0#L6)bi?E?SPymF*a5oDDeSd zO0gx?#KMoOd&G(2O@*W)HgX6y_aa6iMCl^~`{@UR`nMQE`>n_{_aY5nA}vqU8mt8H z`oa=g0SyiLd~BxAj2~l$zRSDHxvDs;I4>+M$W`HbJ|g&P+$!U7-PHX4RAcR0szJ*( ze-417=bO2q{492SWrqDK+L3#ChUHtz*@MP)e^%@>_&#Yk^1|tv@j4%3T)diEX zATx4K*hcO`sY$jk#jN5WD<=C3nvuVsRh||qDHnc~;Kf59zr0;c7VkVSUPD%NnnJC_ zl3F^#f_rDu8l}l8qcAz0FFa)EAt32IUy_JLIhU_J^l~FRH&6-ivSpG2PRqzDdMWft>Zc(c)#tb%wgmWN%>IOPm zZi-noqS!^Ftb81pRcQi`X#UhWK70hy4tGW1mz|+vI8c*h@ zfFGJtW3r>qV>1Z0r|L>7I3un^gcep$AAWfZHRvB|E*kktY$qQP_$YG60C@X~tTQjB3%@`uz!qxtxF+LE!+=nrS^07hn` zEgAp!h|r03h7B!$#OZW#ACD+M;-5J!W+{h|6I;5cNnE(Y863%1(oH}_FTW})8zYb$7czP zg~Szk1+_NTm6SJ0MS_|oSz%e(S~P-&SFp;!k?uFayytV$8HPwuyELSXOs^27XvK-D zOx-Dl!P|28DK6iX>p#Yb%3`A&CG0X2S43FjN%IB}q(!hC$fG}yl1y9W&W&I@KTg6@ zK^kpH8=yFuP+vI^+59|3%Zqnb5lTDAykf z9S#X`3N(X^SpdMyWQGOQRjhiwlj!0W-yD<3aEj^&X%=?`6lCy~?`&WSWt z?U~EKFcCG_RJ(Qp7j=$I%H8t)Z@6VjA#>1f@EYiS8MRHZphp zMA_5`znM=pzUpBPO)pXGYpQ6gkine{6u_o!P@Q+NKJ}k!_X7u|qfpAyIJb$_#3@wJ z<1SE2Edkfk9C!0t%}8Yio09^F`YGzpaJHGk*-ffsn85@)%4@`;Fv^8q(-Wk7r=Q8p zT&hD`5(f?M{gfzGbbwh8(}G#|#fDuk7v1W)5H9wkorE0ZZjL0Q1=NRGY>zwgfm81DdoaVwNH;or{{eSyybt)m<=zXoA^RALYG-2t zouH|L*BLvmm9cdMmn+KGopyR@4*=&0&4g|FLoreZOhRmh=)R0bg~ zT2(8V_q7~42-zvb)+y959OAv!V$u(O3)%Es0M@CRFmG{5sovIq4%8Ahjk#*5w{+)+ zMWQoJI_r$HxL5km1#6(e@{lK3Udc~n0@g`g$s?VrnQJ$!oPnb?IHh-1qA`Rz$)Ai< z6w$-MJW-gKNvOhL+XMbE7&mFt`x1KY>k4(!KbbpZ`>`K@1J<(#vVbjx@Z@(6Q}MF# zMnbr-f55(cTa^q4+#)=s+ThMaV~E`B8V=|W_fZWDwiso8tNMTNse)RNBGi=gVwgg% zbOg8>mbRN%7^Um-7oj4=6`$|(K7!+t^90a{$18Z>}<#!bm%ZEFQ{X(yBZMc>lCz0f1I2w9Sq zuGh<9<=AO&g6BZte6hn>Qmvv;Rt)*cJfTr2=~EnGD8P$v3R|&1RCl&7)b+`=QGapi zPbLg_pxm`+HZurtFZ;wZ=`Vk*do~$wB zxoW&=j0OTbQ=Q%S8XJ%~qoa3Ea|au5o}_(P;=!y-AjFrERh%8la!z6Fn@lR?^E~H12D?8#ht=1F;7@o4$Q8GDj;sSC%Jfn01xgL&%F2 zwG1|5ikb^qHv&9hT8w83+yv&BQXOQyMVJSBL(Ky~p)gU3#%|blG?IR9rP^zUbs7rOA0X52Ao=GRt@C&zlyjNLv-} z9?*x{y(`509qhCV*B47f2hLrGl^<@SuRGR!KwHei?!CM10Tq*YDIoBNyRuO*>3FU? zHjipIE#B~y3FSfOsMfj~F9PNr*H?0oHyYB^G(YyNh{SxcE(Y-`x5jFMKb~HO*m+R% zrq|ic4fzJ#USpTm;X7K+E%xsT_3VHKe?*uc4-FsILUH;kL>_okY(w`VU*8+l>o>Jm ziU#?2^`>arnsl#)*R&nf_%>A+qwl%o{l(u)M?DK1^mf260_oteV3#E_>6Y4!_hhVD zM8AI6MM2V*^_M^sQ0dmHu11fy^kOqXqzpr?K$`}BKWG`=Es(9&S@K@)ZjA{lj3ea7_MBP zk(|hBFRjHVMN!sNUkrB;(cTP)T97M$0Dtc&UXSec<+q?y>5=)}S~{Z@ua;1xt@=T5 zI7{`Z=z_X*no8s>mY;>BvEXK%b`a6(DTS6t&b!vf_z#HM{Uoy_5fiB(zpkF{})ruka$iX*~pq1ZxD?q68dIo zIZSVls9kFGsTwvr4{T_LidcWtt$u{kJlW7moRaH6+A5hW&;;2O#$oKyEN8kx`LmG)Wfq4ykh+q{I3|RfVpkR&QH_x;t41Uw z`P+tft^E2B$domKT@|nNW`EHwyj>&}K;eDpe z1bNOh=fvIfk`&B61+S8ND<(KC%>y&?>opCnY*r5M+!UrWKxv0_QvTlJc>X#AaI^xo zaRXL}t5Ej_Z$y*|w*$6D+A?Lw-CO-$itm^{2Ct82-<0IW)0KMNvJHgBrdsIR0v~=H z?n6^}l{D``Me90`^o|q!olsF?UX3YSq^6Vu>Ijm>>PaZI8G@<^NGw{Cx&%|PwYrfw zR!gX_%AR=L3BFsf8LxI|K^J}deh0ZdV?$3r--FEX`#INxsOG6_=!v)DI>0q|BxT)z z-G6kzA01M?rba+G_mwNMQD1mbVbNTWmBi*{s_v_Ft9m2Avg!^78(QFu&n6mbRJ2bA zv!b;%yo{g*9l2)>tsZJOOp}U~8VUH`}$ z8p_}t*XIOehezolNa-a2x0BS})Y9}&*TPgua{Ewn-=wVrmJUeU39EKx+%w%=ixQWK zDLpwaNJs65#6o7Ln7~~X+p_o2BR1g~VCfxLzxA{HlWAI6^H;`juI=&r1jQrUv_q0Z z1Ja-tjdktrrP>GOC*#p?*xfQU5MqjMsBe!9lh(u8)w$e@Z|>aUHI5o;MGw*|Myiz3 z-f0;pHg~Q#%*Kx8MxH%AluVXjG2C$)WL-K63@Q`#y9_k_+}eR(x4~dp7oV-ek0H>I zgy8p#i4GN{>#v=pFYUQT(g&b$OeTy-X_#FDgNF8XyfGY6R!>inYn8IR2RDa&O!(6< znXs{W!bkP|s_YI*Yx%4stI`=ZO45IK6rBs`g7sP40ic}GZ58s?Mc$&i`kq_tfci>N zIHrC0H+Qpam1bNa=(`SRKjixBTtm&e`j9porEci!zdlg1RI0Jw#b(_Tb@RQK1Zxr_ z%7SUeH6=TrXt3J@js`4iDD0=IoHhK~I7^W8^Rcp~Yaf>2wVe|Hh1bUpX9ATD#moByY57-f2Ef1TP^lBi&p5_s7WGG9|0T}dlfxOx zXvScJO1Cnq`c`~{Dp;{;l<-KkCDE+pmexJkd}zCgE{eF=)K``-qC~IT6GcRog_)!X z?fK^F8UDz$(zFUrwuR$qro5>qqn>+Z%<5>;_*3pZ8QM|yv9CAtrAx;($>4l^_$_-L z*&?(77!-=zvnCVW&kUcZMb6;2!83si518Y%R*A3JZ8Is|kUCMu`!vxDgaWjs7^0j( ziTaS4HhQ)ldR=r)_7vYFUr%THE}cPF{0H45FJ5MQW^+W>P+eEX2kLp3zzFe*-pFVA zdDZRybv?H|>`9f$AKVjFWJ=wegO7hOOIYCtd?Vj{EYLT*^gl35|HQ`R=ti+ADm{jyQE7K@kdjuqJhWVSks>b^ zxha88-h3s;%3_5b1TqFCPTxVjvuB5U>v=HyZ$?JSk+&I%)M7KE*wOg<)1-Iy)8-K! z^XpIt|0ibmk9RtMmlUd7#Ap3Q!q9N4atQy)TmrhrFhfx1DAN`^vq@Q_SRl|V z#lU<~n67$mT)NvHh`%als+G-)x1`Y%4Bp*6Un5Ri9h=_Db zA-AdP!f>f0m@~>7X#uBM?diI@)Egjuz@jXKvm zJo+==juc9_<;CqeRaU9_Mz@;3e=E4=6TK+c`|uu#pIqhSyNm`G(X)&)B`8q0RBv#> z`gGlw(Q=1Xmf55VHj%C#^1lpc>LY8kfA@|rlC1EA<1#`iuyNO z(=;irt{_&K=i4)^x%;U(Xv<)+o=dczC5H3W~+e|f~{*ucxj@{Yi-cw^MqYr3fN zF5D+~!wd$#al?UfMnz(@K#wn`_5na@rRr8XqN@&M&FGEC@`+OEv}sI1hw>Up0qAWf zL#e4~&oM;TVfjRE+10B_gFlLEP9?Q-dARr3xi6nQqnw>k-S;~b z;!0s2VS4}W8b&pGuK=7im+t(`nz@FnT#VD|!)eQNp-W6)@>aA+j~K*H{$G`y2|QHY z|Hmy+CR@#jWY4~)lr1qBJB_RfHJFfP<}pK5(#ZZGSqcpyS&}01LnTWk5fzmXMGHkJ zTP6L^B+uj;lmB_W<~4=${+v0>z31M!-_O@o-O9GyW)j_mjx}!0@br_LE-7SIuPP84 z;5=O(U*g_um0tyG|61N@d9lEuOeiRd+#NY^{nd5;-CVlw&Ap7J?qwM^?E29wvS}2d zbzar4Fz&RSR(-|s!Z6+za&Z zY#D<5q_JUktIzvL0)yq_kLWG6DO{ri=?c!y!f(Dk%G{8)k`Gym%j#!OgXVDD3;$&v@qy#ISJfp=Vm>pls@9-mapVQChAHHd-x+OGx)(*Yr zC1qDUTZ6mM(b_hi!TuFF2k#8uI2;kD70AQ&di$L*4P*Y-@p`jdm%_c3f)XhYD^6M8&#Y$ZpzQMcR|6nsH>b=*R_Von!$BTRj7yGCXokoAQ z&ANvx0-Epw`QIEPgI(^cS2f(Y85yV@ygI{ewyv5Frng)e}KCZF7JbR(&W618_dcEh(#+^zZFY;o<815<5sOHQdeax9_!PyM&;{P zkBa5xymca0#)c#tke@3KNEM8a_mT&1gm;p&&JlMGH(cL(b)BckgMQ^9&vRwj!~3@l zY?L5}=Jzr080OGKb|y`ee(+`flQg|!lo6>=H)X4`$Gz~hLmu2a%kYW_Uu8x09Pa0J zKZ`E$BKJ=2GPj_3l*TEcZ*uYRr<*J^#5pILTT;k_cgto1ZL-%slyc16J~OH-(RgDA z%;EjEnoUkZ&acS{Q8`{i6T5^nywgqQI5bDIymoa7CSZG|WWVk>GM9)zy*bNih|QIm z%0+(Nnc*a_xo;$=!HQYaapLms>J1ToyjtFByY`C2H1wT#178#4+|{H0BBqtCdd$L% z_3Hc60j@{t9~MjM@LBalR&6@>B;9?r<7J~F+WXyYu*y3?px*=8MAK@EA+jRX8{CG?GI-< z54?Dc9CAh>QTAvyOEm0^+x;r2BWX|{3$Y7)L5l*qVE*y0`7J>l2wCmW zL1?|a`pJ-l{fb_N;R(Z9UMiSj6pQjOvQ^%DvhIJF!+Th7jO2~1f1N+(-TyCFYQZYw z4)>7caf^Ki_KJ^Zx2JUb z&$3zJy!*+rCV4%jqwyuNY3j1ZEiltS0xTzd+=itTb;IPYpaf?8Y+RSdVdpacB(bVQ zC(JupLfFp8y43%PMj2}T|VS@%LVp>hv4Y!RPMF?pp8U_$xCJ)S zQx!69>bphNTIb9yn*_yfj{N%bY)t{L1cs8<8|!f$;UQ*}IN=2<6lA;x^(`8t?;+ST zh)z4qeYYgZkIy{$4x28O-pugO&gauRh3;lti9)9Pvw+^)0!h~%m&8Q!AKX%urEMnl z?yEz?g#ODn$UM`+Q#$Q!6|zsq_`dLO5YK-6bJM6ya>}H+vnW^h?o$z;V&wvuM$dR& zeEq;uUUh$XR`TWeC$$c&Jjau2it3#%J-y}Qm>nW*s?En?R&6w@sDXMEr#8~$=b(gk zwDC3)NtAP;M2BW_lL^5ShpK$D%@|BnD{=!Tq)o(5@z3i7Z){} zGr}Exom_qDO{kAVkZ*MbLNHE666Kina#D{&>Jy%~w7yX$oj;cYCd^p9zy z8*+wgSEcj$4{WxKmCF(5o7U4jqwEvO&dm1H#7z}%VXAbW&W24v-tS6N3}qrm1OnE)fUkoE8yMMn9S$?IswS88tQWm4#Oid#ckgr6 zRtHm!mfNl-`d>O*1~d7%;~n+{Rph6BBy^95zqI{K((E!iFQ+h*C3EsbxNo_aRm5gj zKYug($r*Q#W9`p%Bf{bi6;IY0v`pB^^qu)gbg9QHQ7 zWBj(a1YSu)~2RK8Pi#C>{DMlrqFb9e_RehEHyI{n?e3vL_}L>kYJC z_ly$$)zFi*SFyNrnOt(B*7E$??s67EO%DgoZL2XNk8iVx~X_)o++4oaK1M|ou73vA0K^503j@uuVmLcHH4ya-kOIDfM%5%(E z+Xpt~#7y2!KB&)PoyCA+$~DXqxPxxALy!g-O?<9+9KTk4Pgq4AIdUkl`1<1#j^cJg zgU3`0hkHj_jxV>`Y~%LAZl^3o0}`Sm@iw7kwff{M%VwtN)|~!p{AsfA6vB5UolF~d zHWS%*uBDt<9y!9v2Xe|au&1j&iR1HXCdyCjxSgG*L{wmTD4(NQ=mFjpa~xooc6kju z`~+d{j7$h-;HAB04H!Zscu^hZffL#9!p$)9>sRI|Yovm)g@F>ZnosF2EgkU3ln0bR zTA}|+E(tt)!SG)-bEJi_0m{l+(cAz^pi}`9=~n?y&;2eG;d9{M6nj>BHGn(KA2n|O zt}$=FPq!j`p&kQ8>cirSzkU0c08%8{^Qyqi-w2LoO8)^E7;;I1;HQ6B$u0nNaX2CY zSmfi)F`m94zL8>#zu;8|{aBui@RzRKBlP1&mfFxEC@%cjl?NBs`cr^nm){>;$g?rhKr$AO&6qV_Wbn^}5tfFBry^e1`%du2~o zs$~dN;S_#%iwwA_QvmMjh%Qo?0?rR~6liyN5Xmej8(*V9ym*T`xAhHih-v$7U}8=dfXi2i*aAB!xM(Xekg*ix@r|ymDw*{*s0?dlVys2e)z62u1 z+k3esbJE=-P5S$&KdFp+2H7_2e=}OKDrf( z9-207?6$@f4m4B+9E*e((Y89!q?zH|mz_vM>kp*HGXldO0Hg#!EtFhRuOm$u8e~a9 z5(roy7m$Kh+zjW6@zw{&20u?1f2uP&boD}$#Zy)4o&T;vyBoqFiF2t;*g=|1=)PxB z8eM3Mp=l_obbc?I^xyLz?4Y1YDWPa+nm;O<$Cn;@ane616`J9OO2r=rZr{I_Kizyc zP#^^WCdIEp*()rRT+*YZK>V@^Zs=ht32x>Kwe zab)@ZEffz;VM4{XA6e421^h~`ji5r%)B{wZu#hD}f3$y@L0JV9f3g{-RK!A?vBUA}${YF(vO4)@`6f1 z-A|}e#LN{)(eXloDnX4Vs7eH|<@{r#LodP@Nz--$Dg_Par%DCpu2>2jUnqy~|J?eZ zBG4FVsz_A+ibdwv>mLp>P!(t}E>$JGaK$R~;fb{O3($y1ssQQo|5M;^JqC?7qe|hg zu0ZOqeFcp?qVn&Qu7FQJ4hcFi&|nR!*j)MF#b}QO^lN%5)4p*D^H+B){n8%VPUzi! zDihoGcP71a6!ab`l^hK&*dYrVYzJ0)#}xVrp!e;lI!+x+bfCN0KXwUAPU9@#l7@0& QuEJmfE|#`Dqx|px0L@K;Y5)KL diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 005bcde..9d0ce63 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -69,37 +69,35 @@ app_path=$0 # Need this for daisy-chained symlinks. while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { - echo "$*" +echo "$*" } >&2 die () { - echo - echo "$*" - echo - exit 1 +echo +echo "$*" +echo +exit 1 } >&2 # OS specific support (must be 'true' or 'false'). @@ -108,10 +106,10 @@ msys=false darwin=false nonstop=false case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -119,39 +117,46 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi +fi else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi +fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac fi # Collect all arguments for the java command, stacking in reverse order: @@ -164,46 +169,56 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi # Use "xargs" to parse quoted args. # @@ -225,10 +240,10 @@ set -- \ # eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 6a68175..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,20 +34,20 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/com/vertexvis/ApiClient.java b/src/main/java/com/vertexvis/ApiClient.java index 76e1978..544d6ee 100644 --- a/src/main/java/com/vertexvis/ApiClient.java +++ b/src/main/java/com/vertexvis/ApiClient.java @@ -1,6 +1,6 @@ /* * Vertex Platform API - * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. * * The version of the OpenAPI document: 1.0 * Contact: support@vertexvis.com @@ -22,6 +22,7 @@ import okio.BufferedSink; import okio.Okio; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; import javax.net.ssl.*; import java.io.File; @@ -40,6 +41,7 @@ import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; import java.text.DateFormat; import java.time.LocalDate; import java.time.OffsetDateTime; @@ -47,11 +49,13 @@ import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.vertexvis.auth.Authentication; import com.vertexvis.auth.HttpBasicAuth; +import com.vertexvis.auth.HttpBearerAuth; import com.vertexvis.auth.ApiKeyAuth; import com.vertexvis.auth.OAuth; import com.vertexvis.auth.RetryingOAuth; @@ -63,6 +67,20 @@ public class ApiClient { private String basePath = "https://platform.vertexvis.com"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "https://platform.vertexvis.com", + "No description provided", + new HashMap() + ), + new ServerConfiguration( + "https://platform.platdev.vertexvis.io", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; private boolean debugging = false; private Map defaultHeaderMap = new HashMap(); private Map defaultCookieMap = new HashMap(); @@ -171,7 +189,7 @@ public ApiClient(String basePath, String clientId, String clientSecret, Map(); } @@ -226,6 +244,34 @@ public String getBasePath() { */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; return this; } @@ -350,10 +396,10 @@ public DateFormat getDateFormat() { *

Setter for the field dateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link com.vertexvis.ApiClient} object */ public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); + JSON.setDateFormat(dateFormat); return this; } @@ -361,32 +407,32 @@ public ApiClient setDateFormat(DateFormat dateFormat) { *

Set SqlDateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link com.vertexvis.ApiClient} object */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); + JSON.setSqlDateFormat(dateFormat); return this; } /** *

Set OffsetDateTimeFormat.

* - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.vertexvis.ApiClient} object */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); + JSON.setOffsetDateTimeFormat(dateFormat); return this; } /** *

Set LocalDateFormat.

* - * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.vertexvis.ApiClient} object */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); + JSON.setLocalDateFormat(dateFormat); return this; } @@ -394,10 +440,10 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { *

Set LenientOnJson.

* * @param lenientOnJson a boolean - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link com.vertexvis.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); + JSON.setLenientOnJson(lenientOnJson); return this; } @@ -496,6 +542,31 @@ public void setAccessToken(String accessToken) { throw new RuntimeException("No OAuth2 authentication configured!"); } + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + /** * Set the User-Agent header's value (by adding to the default header map). * @@ -678,7 +749,7 @@ public String parameterToString(Object param) { return ""; } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); + String jsonStr = JSON.serialize(param); return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); @@ -686,7 +757,7 @@ public String parameterToString(Object param) { if (b.length() > 0) { b.append(","); } - b.append(String.valueOf(o)); + b.append(o); } return b.toString(); } else { @@ -765,6 +836,31 @@ public List parameterToPairs(String collectionFormat, String name, Collect return params; } + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + /** * Formats the specified collection path parameter to a string value. * @@ -896,7 +992,7 @@ public String escapeString(String str) { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws com.vertexvis.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -937,7 +1033,7 @@ public T deserialize(Response response, Type returnType) throws ApiException contentType = "application/json"; } if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); + return JSON.deserialize(respBody, returnType); } else if (returnType.equals(String.class)) { // Expecting string, return the raw response body. return (T) respBody; @@ -957,7 +1053,7 @@ public T deserialize(Response response, Type returnType) throws ApiException * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws org.openapitools.client.ApiException If fail to serialize the given object + * @throws com.vertexvis.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -971,11 +1067,13 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException } else if (isJsonMime(contentType)) { String content; if (obj != null) { - content = json.serialize(obj); + content = JSON.serialize(obj); } else { content = null; } return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } @@ -985,7 +1083,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @throws com.vertexvis.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -1049,7 +1147,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws com.vertexvis.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1064,7 +1162,7 @@ public ApiResponse execute(Call call) throws ApiException { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws com.vertexvis.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1128,7 +1226,7 @@ public void onResponse(Call call, Response response) throws IOException { * @param response Response * @param returnType Return type * @return Type - * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * @throws com.vertexvis.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1163,6 +1261,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept /** * Build HTTP call with the given options. * + * @param baseUrl The base URL * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters @@ -1174,7 +1273,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws com.vertexvis.ApiException If fail to serialize the request body object */ public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1185,6 +1284,7 @@ public Call buildCall(String baseUrl, String path, String method, List que /** * Build an HTTP request with the given options. * + * @param baseUrl The base URL * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters @@ -1196,24 +1296,23 @@ public Call buildCall(String baseUrl, String path, String method, List que * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws com.vertexvis.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body RequestBody reqBody; String contentType = headerParams.get("Content-Type"); - + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { + } else if ("multipart/form-data".equals(contentTypePure)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { if ("DELETE".equals(method)) { @@ -1221,16 +1320,18 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); @@ -1253,6 +1354,7 @@ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List if (baseUrl != null) { url.append(baseUrl).append(path); } else { - url.append(basePath).append(path); + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); } if (queryParams != null && !queryParams.isEmpty()) { @@ -1347,6 +1460,7 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param payload HTTP request body * @param method HTTP method * @param uri URI + * @throws com.vertexvis.ApiException If fails to update the parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { @@ -1385,12 +1499,18 @@ public RequestBody buildRequestBodyMultipart(Map formParams) { for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); } } return mpBuilder.build(); @@ -1411,6 +1531,44 @@ public String guessContentTypeFromFile(File file) { } } + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + /** * Get network interceptor to add it to the httpClient to track download progress for * async requests. @@ -1478,7 +1636,7 @@ public boolean verify(String hostname, SSLSession session) { KeyStore caKeyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); + String certificateAlias = "ca" + (index++); caKeyStore.setCertificateEntry(certificateAlias, certificate); } trustManagerFactory.init(caKeyStore); @@ -1511,9 +1669,9 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti /** * Convert the HTTP request body to a string. * - * @param request The HTTP request object + * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + * @throws com.vertexvis.ApiException If fail to serialize the request body object into a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/src/main/java/com/vertexvis/ApiException.java b/src/main/java/com/vertexvis/ApiException.java index f33f7be..c40d383 100644 --- a/src/main/java/com/vertexvis/ApiException.java +++ b/src/main/java/com/vertexvis/ApiException.java @@ -16,16 +16,19 @@ import java.util.Map; import java.util.List; + /** *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApiException extends RuntimeException { + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + /** *

Constructor for ApiException.

*/ @@ -97,7 +100,7 @@ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); } /** @@ -151,4 +154,14 @@ public Map> getResponseHeaders() { public String getResponseBody() { return responseBody; } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } } diff --git a/src/main/java/com/vertexvis/Configuration.java b/src/main/java/com/vertexvis/Configuration.java index e9edaf4..63d7b0d 100644 --- a/src/main/java/com/vertexvis/Configuration.java +++ b/src/main/java/com/vertexvis/Configuration.java @@ -13,8 +13,10 @@ package com.vertexvis; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Configuration { + public static final String VERSION = "1.0"; + private static ApiClient defaultApiClient = new ApiClient(); /** diff --git a/src/main/java/com/vertexvis/JSON.java b/src/main/java/com/vertexvis/JSON.java index 1527b67..5a2614c 100644 --- a/src/main/java/com/vertexvis/JSON.java +++ b/src/main/java/com/vertexvis/JSON.java @@ -1,13 +1,6 @@ /* * Vertex Platform API - * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which - * together allow easily integrating 3D product data into your business application. See our - * [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get - * started. Notes about the Postman collection and API Reference code samples, - They include - * all required and optional body parameters for completeness. Remove any optional parameters as - * desired. - They use auto-generated IDs and other values that may share the same value for - * ease of documentation only. In actual requests and responses, the IDs should uniquely identify - * their corresponding resource. + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. * * The version of the OpenAPI document: 1.0 * Contact: support@vertexvis.com @@ -22,15 +15,16 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.*; -import com.vertexvis.model.serialization.*; +import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; import java.io.IOException; import java.io.StringReader; @@ -42,106 +36,490 @@ import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; +import java.util.Locale; import java.util.Map; +import java.util.HashMap; -import okio.ByteString; - +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ public class JSON { - private Gson gson; - private boolean isLenientOnJson = false; - private final DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private final SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private final OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = - new OffsetDateTimeTypeAdapter(); - private final LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private final ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); @SuppressWarnings("unchecked") public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(com.vertexvis.model.CADExportConfig.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CADExportConfig", com.vertexvis.model.CADExportConfig.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "format")); + } + }) + .registerTypeSelector(com.vertexvis.model.CreateExportRequestDataAttributesConfig.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("jt", com.vertexvis.model.CADExportConfig.class); + classByDiscriminatorValue.put("step", com.vertexvis.model.CADExportConfig.class); + classByDiscriminatorValue.put("x_t", com.vertexvis.model.CADExportConfig.class); + classByDiscriminatorValue.put("CADExportConfig", com.vertexvis.model.CADExportConfig.class); + classByDiscriminatorValue.put("CreateExportRequest_data_attributes_config", com.vertexvis.model.CreateExportRequestDataAttributesConfig.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "format")); + } + }) + .registerTypeSelector(com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("callout", com.vertexvis.model.SceneAnnotationCalloutDataType.class); + classByDiscriminatorValue.put("custom", com.vertexvis.model.SceneAnnotationCustomDataType.class); + classByDiscriminatorValue.put("SceneAnnotationCalloutDataType", com.vertexvis.model.SceneAnnotationCalloutDataType.class); + classByDiscriminatorValue.put("SceneAnnotationCustomDataType", com.vertexvis.model.SceneAnnotationCustomDataType.class); + classByDiscriminatorValue.put("CreateSceneAnnotationRequest_data_attributes_data", com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(com.vertexvis.model.CreateSceneSyncRequestOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("update-to-default-rendition", com.vertexvis.model.UpdateItemToDefaultRenditionOperation.class); + classByDiscriminatorValue.put("UpdateItemToDefaultRenditionOperation", com.vertexvis.model.UpdateItemToDefaultRenditionOperation.class); + classByDiscriminatorValue.put("CreateSceneSyncRequest_operation", com.vertexvis.model.CreateSceneSyncRequestOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(com.vertexvis.model.ExportConfig.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CADExportConfig", com.vertexvis.model.CADExportConfig.class); + classByDiscriminatorValue.put("ExportConfig", com.vertexvis.model.ExportConfig.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "format")); + } + }) + .registerTypeSelector(com.vertexvis.model.WebhookEventIncludedInner.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("part-revision", com.vertexvis.model.WebhookEventPartRevisionIncludedData.class); + classByDiscriminatorValue.put("scene", com.vertexvis.model.WebhookEventSceneIncludedData.class); + classByDiscriminatorValue.put("WebhookEventPartRevisionIncludedData", com.vertexvis.model.WebhookEventPartRevisionIncludedData.class); + classByDiscriminatorValue.put("WebhookEventSceneIncludedData", com.vertexvis.model.WebhookEventSceneIncludedData.class); + classByDiscriminatorValue.put("WebhookEvent_included_inner", com.vertexvis.model.WebhookEventIncludedInner.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; } - private static String getDiscriminatorValue(JsonElement readElement, - String discriminatorField) { + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); if (null == element) { - throw new IllegalArgumentException( - "missing discriminator field: <" + discriminatorField + ">"); + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); } /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator - * value. + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. * * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. * @return The Java class that implements the OpenAPI schema */ - private static Class getClassByDiscriminator(Map classByDiscriminatorValue, - String discriminatorValue) { + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); if (null == clazz) { - throw new IllegalArgumentException( - "cannot determine model class of name: <" + discriminatorValue + ">"); + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; } - public JSON() { - gson = createGson().registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - .registerTypeAdapter(byte[].class, byteArrayAdapter).registerTypeAdapter( - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.class, - new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter( - () -> gson)) - .registerTypeAdapter(AnyOfQueryByIdQueryByCollectionQueryAll.class, - new AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter(() -> gson)) - .registerTypeAdapter(AnyOfCameraCameraFit.class, - new AnyOfCameraCameraFitTypeAdapter(() -> gson)).registerTypeAdapter( - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.class, - new AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter( - () -> gson)).registerTypeAdapter( - AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.class, - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter( - () -> gson)) - .registerTypeAdapter(OneOfHitResultDataSceneItemDataPartRevisionData.class, - new OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter(() -> gson)) - .registerTypeAdapter(AnyOfGeometrySetRelationshipPartRevisionRelationship.class, - new AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter( - () -> gson)) - .registerTypeAdapter(OneOfSceneViewRelationshipSceneViewStateRelationship.class, - new OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter( - () -> gson)) - .registerTypeAdapter(AnyOfRelationshipDataApiError.class, - new AnyOfRelationshipDataApiErrorAdapter(() -> gson)) - .registerTypeAdapter(AnyOfCreateSceneItemRequestData.class, - new AnyOfCreateSceneItemRequestDataAdapter(() -> gson)) - .registerTypeAdapter(OneOfPerspectiveCameraOrthographicCamera.class, - new OneOfPerspectiveCameraOrthographicCameraTypeAdapter(() -> gson)) - .registerTypeAdapter(AnyOfPerspectiveCameraOrthographicCameraCameraFit.class, - new AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter( - () -> gson)) - .registerTypeAdapter(AnyOfFileRelationshipPartAssemblyRelationship.class, - new AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter(() -> gson)) - .registerTypeAdapter( - OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.class, - new OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter(() -> gson) - ) - .registerTypeAdapter( - OneOfUpdateItemToDefaultRenditionOperation.class, - new OneOfUpdateItemToDefaultRenditionOperationTypeAdapter(() -> gson) - ) - .registerTypeAdapter( - AnyOfGeometrySetDataPartRevisionDataPartRenditionData.class, - new AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter(() -> gson) - ) - .create(); + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Account.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AccountDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminConsentAcceptRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminConsentAcceptRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminConsentAcceptRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminCreateApplicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminCreateApplicationRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminCreateApplicationRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminLoginAcceptRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminLoginAcceptRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminLoginAcceptRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.AdminRedirectTo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ApiError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ApiErrorSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Application.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ApplicationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ApplicationDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ApplicationList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Batch.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.BatchOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.BatchOperationRef.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.BatchVertexvisBatchResultsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.BoundingBox.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CADExportConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CameraFit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ChangeMaterialOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ChangeTransformOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ChangeVisibilityOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ClearMaterialOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ClearRenOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ClearRepOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ClearTransformOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Color3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ColorMaterial.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ColorMaterialNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateAccountRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateAccountRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateAccountRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateApplicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateBatchRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateExportRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateExportRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateExportRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateExportRequestDataAttributesConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateExportRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateFileRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateFileRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateFileRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateGeometrySetRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateGeometrySetRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateGeometrySetRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataRelationshipsSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAlterationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAlterationRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAlterationRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationSetRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationSetRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAnnotationSetRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemOverrideRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemOverrideRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemOverrideRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemOverrideRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneItemRequestDataRelationshipsSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneSyncRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneSyncRequestOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewStateRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewStateRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewStateRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewStateRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneViewStateRequestDataRelationshipsSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateStreamKeyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateStreamKeyRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateStreamKeyRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateTranslationInspectionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateTranslationInspectionRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateWebhookSubscriptionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateWebhookSubscriptionRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateWebhookSubscriptionRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatedApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatedApplicationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatedApplicationDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CrossSectioning.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.DeselectOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Dimensions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Export.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportStateRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ExportStateRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Failure.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FeatureLines.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileMetadataData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileMetadataDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FileRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.FilterExpression.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Hit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitIncludedInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitResultData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitResultDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitResultDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Link.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MaterialOverride.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Matrix4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Matrix4Nullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataDateType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataFloatType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataLongType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataNullType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataStringType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelView.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.OAuth2BadRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.OAuth2Token.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Orientation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.OrthographicCamera.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Part.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartAssemblyRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartAssemblyRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataRelationshipsPartRevisions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartInstanceRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartInstanceRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRendition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRenditionRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevision.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionInstance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionInstanceData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionInstanceDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionInstanceDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionInstanceList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartRevisionSuppliedId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PerspectiveCamera.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PmiAnnotationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PmiAnnotationList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Point.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyDateType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyDoubleType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryDataAttributesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyKeyType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyLongType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertySetRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertySetRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyStringType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryByCollection.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryByCollectionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryByCollectionDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryById.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryByIdData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueryByIdDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedJob.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedJobData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedJobDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedJobList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedTranslationJob.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedTranslationJobData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedTranslationJobDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedTranslationJobDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.QueuedTranslationJobIncludedInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.RelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.RelationshipLinks.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.RevokeOAuth2TokenRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.RevokeOAuth2TokenRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.RevokeOAuth2TokenRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Scene.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAlteration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAlterationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAlterationDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAlterationList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationCalloutDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationCustomDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationSetData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationSetDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneAnnotationSetList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemDataRelationshipsSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemOverride.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemOverrideData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemOverrideDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemOverrideDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemOverrideList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneItemRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneOperationOperationsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneOperationQuery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSync.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncItemResultData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncItemResultDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncItemResultDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneSyncItemResultsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneView.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewState.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewStateData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewStateDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewStateList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewStateRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SceneViewStateRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SectionPlane.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.SelectOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.StreamKey.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.StreamKeyData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.StreamKeyDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.StreamKeyList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ThumbnailData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.TranslationInspectionJob.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.TranslationInspectionJobData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.TranslationInspectionJobDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateAccountRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateAccountRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateAccountRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateApplicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateApplicationRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateApplicationRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateFileRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateFileRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateFileRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateItemToDefaultRenditionOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdatePartRevisionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdatePartRevisionRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdatePartRevisionRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdatePartRevisionRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneAnnotationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneAnnotationRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneAnnotationRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemOverrideRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemOverrideRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemOverrideRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneItemRequestDataRelationshipsSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewRequestDataAttributesCamera.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewStateRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateSceneViewStateRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateWebhookSubscriptionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateWebhookSubscriptionRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpdateWebhookSubscriptionRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequestDataAttributesEntriesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequestDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.UpsertPropertyEntriesRequestDataRelationshipsPropertySet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Vector3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Vector4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ViewDefaultRenOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ViewRenByIdOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ViewRenBySuppliedIdOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ViewRepByIdOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ViewRepByPredefinedIdOp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataRelationshipsOwner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataRelationshipsOwnerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataRelationshipsResource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventDataRelationshipsResourceData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventIncludedInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventPartRevisionIncludedAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventPartRevisionIncludedData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventSceneIncludedAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookEventSceneIncludedData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookSubscription.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookSubscriptionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookSubscriptionDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.WebhookSubscriptionList.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); } /** @@ -149,7 +527,7 @@ public JSON() { * * @return Gson */ - public Gson getGson() { + public static Gson getGson() { return gson; } @@ -157,16 +535,13 @@ public Gson getGson() { * Set Gson. * * @param gson Gson - * @return JSON */ - public JSON setGson(Gson gson) { - this.gson = gson; - return this; + public static void setGson(Gson gson) { + JSON.gson = gson; } - public JSON setLenientOnJson(boolean lenientOnJson) { + public static void setLenientOnJson(boolean lenientOnJson) { isLenientOnJson = lenientOnJson; - return this; } /** @@ -175,7 +550,7 @@ public JSON setLenientOnJson(boolean lenientOnJson) { * @param obj Object * @return String representation of the JSON */ - public String serialize(Object obj) { + public static String serialize(Object obj) { return gson.toJson(obj); } @@ -188,25 +563,22 @@ public String serialize(Object obj) { * @return The deserialized Java object */ @SuppressWarnings("unchecked") - public T deserialize(String body, Type returnType) { + public static T deserialize(String body, Type returnType) { try { if (isLenientOnJson) { JsonReader jsonReader = new JsonReader(new StringReader(body)); // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) jsonReader.setLenient(true); return gson.fromJson(jsonReader, returnType); - } - else { + } else { return gson.fromJson(body, returnType); } - } - catch (JsonParseException e) { + } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; if (returnType.equals(String.class)) { return (T) body; - } - else { + } else { throw (e); } } @@ -215,14 +587,13 @@ public T deserialize(String body, Type returnType) { /** * Gson TypeAdapter for Byte Array type */ - public class ByteArrayAdapter extends TypeAdapter { + public static class ByteArrayAdapter extends TypeAdapter { @Override public void write(JsonWriter out, byte[] value) throws IOException { if (value == null) { out.nullValue(); - } - else { + } else { out.value(ByteString.of(value).base64()); } } @@ -264,8 +635,7 @@ public void setFormat(DateTimeFormatter dateFormat) { public void write(JsonWriter out, OffsetDateTime date) throws IOException { if (date == null) { out.nullValue(); - } - else { + } else { out.value(formatter.format(date)); } } @@ -279,7 +649,7 @@ public OffsetDateTime read(JsonReader in) throws IOException { default: String date = in.nextString(); if (date.endsWith("+0000")) { - date = date.substring(0, date.length() - 5) + "Z"; + date = date.substring(0, date.length()-5) + "Z"; } return OffsetDateTime.parse(date, formatter); } @@ -289,7 +659,7 @@ public OffsetDateTime read(JsonReader in) throws IOException { /** * Gson TypeAdapter for JSR310 LocalDate type */ - public class LocalDateTypeAdapter extends TypeAdapter { + public static class LocalDateTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -309,8 +679,7 @@ public void setFormat(DateTimeFormatter dateFormat) { public void write(JsonWriter out, LocalDate date) throws IOException { if (date == null) { out.nullValue(); - } - else { + } else { out.value(formatter.format(date)); } } @@ -328,14 +697,12 @@ public LocalDate read(JsonReader in) throws IOException { } } - public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { offsetDateTimeTypeAdapter.setFormat(dateFormat); - return this; } - public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { localDateTypeAdapter.setFormat(dateFormat); - return this; } /** @@ -347,8 +714,7 @@ public static class SqlDateTypeAdapter extends TypeAdapter { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -362,13 +728,11 @@ public void setFormat(DateFormat dateFormat) { public void write(JsonWriter out, java.sql.Date date) throws IOException { if (date == null) { out.nullValue(); - } - else { + } else { String value; if (dateFormat != null) { value = dateFormat.format(date); - } - else { + } else { value = date.toString(); } out.value(value); @@ -387,10 +751,8 @@ public java.sql.Date read(JsonReader in) throws IOException { if (dateFormat != null) { return new java.sql.Date(dateFormat.parse(date).getTime()); } - return new java.sql.Date( - ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); - } - catch (ParseException e) { + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { throw new JsonParseException(e); } } @@ -405,8 +767,7 @@ public static class DateTypeAdapter extends TypeAdapter { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -420,13 +781,11 @@ public void setFormat(DateFormat dateFormat) { public void write(JsonWriter out, Date date) throws IOException { if (date == null) { out.nullValue(); - } - else { + } else { String value; if (dateFormat != null) { value = dateFormat.format(date); - } - else { + } else { value = ISO8601Utils.format(date, true); } out.value(value); @@ -447,26 +806,21 @@ public Date read(JsonReader in) throws IOException { return dateFormat.parse(date); } return ISO8601Utils.parse(date, new ParsePosition(0)); - } - catch (ParseException e) { + } catch (ParseException e) { throw new JsonParseException(e); } } - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { throw new JsonParseException(e); } } } - public JSON setDateFormat(DateFormat dateFormat) { + public static void setDateFormat(DateFormat dateFormat) { dateTypeAdapter.setFormat(dateFormat); - return this; } - public JSON setSqlDateFormat(DateFormat dateFormat) { + public static void setSqlDateFormat(DateFormat dateFormat) { sqlDateTypeAdapter.setFormat(dateFormat); - return this; } - } diff --git a/src/main/java/com/vertexvis/Pair.java b/src/main/java/com/vertexvis/Pair.java index 4a6e6eb..20acb5f 100644 --- a/src/main/java/com/vertexvis/Pair.java +++ b/src/main/java/com/vertexvis/Pair.java @@ -13,7 +13,7 @@ package com.vertexvis; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/com/vertexvis/ServerConfiguration.java b/src/main/java/com/vertexvis/ServerConfiguration.java index 280bbf8..69998cf 100644 --- a/src/main/java/com/vertexvis/ServerConfiguration.java +++ b/src/main/java/com/vertexvis/ServerConfiguration.java @@ -1,3 +1,16 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.vertexvis; import java.util.Map; @@ -5,6 +18,7 @@ /** * Representing a Server configuration. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ServerConfiguration { public String URL; public String description; @@ -39,10 +53,10 @@ public String URL(Map variables) { if (variables != null && variables.containsKey(name)) { value = variables.get(name); if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } - url = url.replaceAll("\\{" + name + "\\}", value); + url = url.replace("{" + name + "}", value); } return url; } diff --git a/src/main/java/com/vertexvis/ServerVariable.java b/src/main/java/com/vertexvis/ServerVariable.java index e056944..a813214 100644 --- a/src/main/java/com/vertexvis/ServerVariable.java +++ b/src/main/java/com/vertexvis/ServerVariable.java @@ -1,3 +1,16 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.vertexvis; import java.util.HashSet; @@ -5,6 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/vertexvis/StringUtil.java b/src/main/java/com/vertexvis/StringUtil.java index 8a57e80..933ced5 100644 --- a/src/main/java/com/vertexvis/StringUtil.java +++ b/src/main/java/com/vertexvis/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/com/vertexvis/api/AccountsApi.java b/src/main/java/com/vertexvis/api/AccountsApi.java index 2ecfe3b..d7176f2 100644 --- a/src/main/java/com/vertexvis/api/AccountsApi.java +++ b/src/main/java/com/vertexvis/api/AccountsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -95,7 +96,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createAccountCall(CreateAccountRequest createAccountRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -141,15 +141,12 @@ public okhttp3.Call createAccountCall(CreateAccountRequest createAccountRequest, @SuppressWarnings("rawtypes") private okhttp3.Call createAccountValidateBeforeCall(CreateAccountRequest createAccountRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createAccountRequest' is set if (createAccountRequest == null) { throw new ApiException("Missing the required parameter 'createAccountRequest' when calling createAccount(Async)"); } - - okhttp3.Call localVarCall = createAccountCall(createAccountRequest, _callback); - return localVarCall; + return createAccountCall(createAccountRequest, _callback); } @@ -160,7 +157,8 @@ private okhttp3.Call createAccountValidateBeforeCall(CreateAccountRequest create * @return Account * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -180,7 +178,8 @@ public Account createAccount(CreateAccountRequest createAccountRequest) throws A * @return ApiResponse<Account> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -202,7 +201,8 @@ public ApiResponse createAccountWithHttpInfo(CreateAccountRequest creat * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -225,7 +225,8 @@ public okhttp3.Call createAccountAsync(CreateAccountRequest createAccountRequest * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -236,7 +237,6 @@ public okhttp3.Call createAccountAsync(CreateAccountRequest createAccountRequest */ public okhttp3.Call createApplicationForAccountCall(UUID id, AdminCreateApplicationRequest adminCreateApplicationRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -253,7 +253,7 @@ public okhttp3.Call createApplicationForAccountCall(UUID id, AdminCreateApplicat // create path and map variables String localVarPath = "/accounts/{id}/applications" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -283,20 +283,17 @@ public okhttp3.Call createApplicationForAccountCall(UUID id, AdminCreateApplicat @SuppressWarnings("rawtypes") private okhttp3.Call createApplicationForAccountValidateBeforeCall(UUID id, AdminCreateApplicationRequest adminCreateApplicationRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createApplicationForAccount(Async)"); } - + // verify the required parameter 'adminCreateApplicationRequest' is set if (adminCreateApplicationRequest == null) { throw new ApiException("Missing the required parameter 'adminCreateApplicationRequest' when calling createApplicationForAccount(Async)"); } - - okhttp3.Call localVarCall = createApplicationForAccountCall(id, adminCreateApplicationRequest, _callback); - return localVarCall; + return createApplicationForAccountCall(id, adminCreateApplicationRequest, _callback); } @@ -308,7 +305,8 @@ private okhttp3.Call createApplicationForAccountValidateBeforeCall(UUID id, Admi * @return CreatedApplication * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -330,7 +328,8 @@ public CreatedApplication createApplicationForAccount(UUID id, AdminCreateApplic * @return ApiResponse<CreatedApplication> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -354,7 +353,8 @@ public ApiResponse createApplicationForAccountWithHttpInfo(U * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -377,7 +377,8 @@ public okhttp3.Call createApplicationForAccountAsync(UUID id, AdminCreateApplica * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -387,7 +388,6 @@ public okhttp3.Call createApplicationForAccountAsync(UUID id, AdminCreateApplica */ public okhttp3.Call deleteAccountCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -404,7 +404,7 @@ public okhttp3.Call deleteAccountCall(UUID id, final ApiCallback _callback) thro // create path and map variables String localVarPath = "/accounts/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -421,7 +421,6 @@ public okhttp3.Call deleteAccountCall(UUID id, final ApiCallback _callback) thro } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -434,15 +433,12 @@ public okhttp3.Call deleteAccountCall(UUID id, final ApiCallback _callback) thro @SuppressWarnings("rawtypes") private okhttp3.Call deleteAccountValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteAccount(Async)"); } - - okhttp3.Call localVarCall = deleteAccountCall(id, _callback); - return localVarCall; + return deleteAccountCall(id, _callback); } @@ -452,7 +448,8 @@ private okhttp3.Call deleteAccountValidateBeforeCall(UUID id, final ApiCallback * @param id The `account` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -471,7 +468,8 @@ public void deleteAccount(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -492,7 +490,8 @@ public ApiResponse deleteAccountWithHttpInfo(UUID id) throws ApiException * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -513,7 +512,8 @@ public okhttp3.Call deleteAccountAsync(UUID id, final ApiCallback _callbac * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -523,7 +523,6 @@ public okhttp3.Call deleteAccountAsync(UUID id, final ApiCallback _callbac */ public okhttp3.Call getAccountCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -540,7 +539,7 @@ public okhttp3.Call getAccountCall(UUID id, final ApiCallback _callback) throws // create path and map variables String localVarPath = "/accounts/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -557,7 +556,6 @@ public okhttp3.Call getAccountCall(UUID id, final ApiCallback _callback) throws } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -570,15 +568,12 @@ public okhttp3.Call getAccountCall(UUID id, final ApiCallback _callback) throws @SuppressWarnings("rawtypes") private okhttp3.Call getAccountValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getAccount(Async)"); } - - okhttp3.Call localVarCall = getAccountCall(id, _callback); - return localVarCall; + return getAccountCall(id, _callback); } @@ -589,7 +584,8 @@ private okhttp3.Call getAccountValidateBeforeCall(UUID id, final ApiCallback _ca * @return Account * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -609,7 +605,8 @@ public Account getAccount(UUID id) throws ApiException { * @return ApiResponse<Account> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -631,7 +628,8 @@ public ApiResponse getAccountWithHttpInfo(UUID id) throws ApiException * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -654,7 +652,8 @@ public okhttp3.Call getAccountAsync(UUID id, final ApiCallback _callbac * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -665,7 +664,6 @@ public okhttp3.Call getAccountAsync(UUID id, final ApiCallback _callbac */ public okhttp3.Call updateAccountCall(UUID id, UpdateAccountRequest updateAccountRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -682,7 +680,7 @@ public okhttp3.Call updateAccountCall(UUID id, UpdateAccountRequest updateAccoun // create path and map variables String localVarPath = "/accounts/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -712,20 +710,17 @@ public okhttp3.Call updateAccountCall(UUID id, UpdateAccountRequest updateAccoun @SuppressWarnings("rawtypes") private okhttp3.Call updateAccountValidateBeforeCall(UUID id, UpdateAccountRequest updateAccountRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateAccount(Async)"); } - + // verify the required parameter 'updateAccountRequest' is set if (updateAccountRequest == null) { throw new ApiException("Missing the required parameter 'updateAccountRequest' when calling updateAccount(Async)"); } - - okhttp3.Call localVarCall = updateAccountCall(id, updateAccountRequest, _callback); - return localVarCall; + return updateAccountCall(id, updateAccountRequest, _callback); } @@ -737,7 +732,8 @@ private okhttp3.Call updateAccountValidateBeforeCall(UUID id, UpdateAccountReque * @return Account * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -759,7 +755,8 @@ public Account updateAccount(UUID id, UpdateAccountRequest updateAccountRequest) * @return ApiResponse<Account> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -783,7 +780,8 @@ public ApiResponse updateAccountWithHttpInfo(UUID id, UpdateAccountRequ * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/ApplicationsApi.java b/src/main/java/com/vertexvis/api/ApplicationsApi.java index 1bd64d7..fd0376a 100644 --- a/src/main/java/com/vertexvis/api/ApplicationsApi.java +++ b/src/main/java/com/vertexvis/api/ApplicationsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -95,7 +96,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createApplicationCall(CreateApplicationRequest createApplicationRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -141,15 +141,12 @@ public okhttp3.Call createApplicationCall(CreateApplicationRequest createApplica @SuppressWarnings("rawtypes") private okhttp3.Call createApplicationValidateBeforeCall(CreateApplicationRequest createApplicationRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createApplicationRequest' is set if (createApplicationRequest == null) { throw new ApiException("Missing the required parameter 'createApplicationRequest' when calling createApplication(Async)"); } - - okhttp3.Call localVarCall = createApplicationCall(createApplicationRequest, _callback); - return localVarCall; + return createApplicationCall(createApplicationRequest, _callback); } @@ -160,7 +157,8 @@ private okhttp3.Call createApplicationValidateBeforeCall(CreateApplicationReques * @return CreatedApplication * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -180,7 +178,8 @@ public CreatedApplication createApplication(CreateApplicationRequest createAppli * @return ApiResponse<CreatedApplication> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -202,7 +201,8 @@ public ApiResponse createApplicationWithHttpInfo(CreateAppli * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -224,7 +224,8 @@ public okhttp3.Call createApplicationAsync(CreateApplicationRequest createApplic * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -234,7 +235,6 @@ public okhttp3.Call createApplicationAsync(CreateApplicationRequest createApplic */ public okhttp3.Call deleteApplicationCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -251,7 +251,7 @@ public okhttp3.Call deleteApplicationCall(UUID id, final ApiCallback _callback) // create path and map variables String localVarPath = "/applications/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -268,7 +268,6 @@ public okhttp3.Call deleteApplicationCall(UUID id, final ApiCallback _callback) } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -281,15 +280,12 @@ public okhttp3.Call deleteApplicationCall(UUID id, final ApiCallback _callback) @SuppressWarnings("rawtypes") private okhttp3.Call deleteApplicationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteApplication(Async)"); } - - okhttp3.Call localVarCall = deleteApplicationCall(id, _callback); - return localVarCall; + return deleteApplicationCall(id, _callback); } @@ -299,7 +295,8 @@ private okhttp3.Call deleteApplicationValidateBeforeCall(UUID id, final ApiCallb * @param id The `application` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -318,7 +315,8 @@ public void deleteApplication(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -339,7 +337,8 @@ public ApiResponse deleteApplicationWithHttpInfo(UUID id) throws ApiExcept * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -360,7 +359,8 @@ public okhttp3.Call deleteApplicationAsync(UUID id, final ApiCallback _cal * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -370,7 +370,6 @@ public okhttp3.Call deleteApplicationAsync(UUID id, final ApiCallback _cal */ public okhttp3.Call getApplicationCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -387,7 +386,7 @@ public okhttp3.Call getApplicationCall(UUID id, final ApiCallback _callback) thr // create path and map variables String localVarPath = "/applications/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -404,7 +403,6 @@ public okhttp3.Call getApplicationCall(UUID id, final ApiCallback _callback) thr } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -417,15 +415,12 @@ public okhttp3.Call getApplicationCall(UUID id, final ApiCallback _callback) thr @SuppressWarnings("rawtypes") private okhttp3.Call getApplicationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getApplication(Async)"); } - - okhttp3.Call localVarCall = getApplicationCall(id, _callback); - return localVarCall; + return getApplicationCall(id, _callback); } @@ -436,7 +431,8 @@ private okhttp3.Call getApplicationValidateBeforeCall(UUID id, final ApiCallback * @return Application * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -456,7 +452,8 @@ public Application getApplication(UUID id) throws ApiException { * @return ApiResponse<Application> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -478,7 +475,8 @@ public ApiResponse getApplicationWithHttpInfo(UUID id) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -502,7 +500,8 @@ public okhttp3.Call getApplicationAsync(UUID id, final ApiCallback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -511,7 +510,6 @@ public okhttp3.Call getApplicationAsync(UUID id, final ApiCallback */ public okhttp3.Call getApplicationsCall(String pageCursor, Integer pageSize, String filterClientId, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -556,7 +554,6 @@ public okhttp3.Call getApplicationsCall(String pageCursor, Integer pageSize, Str } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -569,10 +566,7 @@ public okhttp3.Call getApplicationsCall(String pageCursor, Integer pageSize, Str @SuppressWarnings("rawtypes") private okhttp3.Call getApplicationsValidateBeforeCall(String pageCursor, Integer pageSize, String filterClientId, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getApplicationsCall(pageCursor, pageSize, filterClientId, _callback); - return localVarCall; + return getApplicationsCall(pageCursor, pageSize, filterClientId, _callback); } @@ -585,7 +579,8 @@ private okhttp3.Call getApplicationsValidateBeforeCall(String pageCursor, Intege * @return ApplicationList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -606,7 +601,8 @@ public ApplicationList getApplications(String pageCursor, Integer pageSize, Stri * @return ApiResponse<ApplicationList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -629,7 +625,8 @@ public ApiResponse getApplicationsWithHttpInfo(String pageCurso * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -651,7 +648,8 @@ public okhttp3.Call getApplicationsAsync(String pageCursor, Integer pageSize, St * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -662,7 +660,6 @@ public okhttp3.Call getApplicationsAsync(String pageCursor, Integer pageSize, St */ public okhttp3.Call updateApplicationCall(UUID id, UpdateApplicationRequest updateApplicationRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -679,7 +676,7 @@ public okhttp3.Call updateApplicationCall(UUID id, UpdateApplicationRequest upda // create path and map variables String localVarPath = "/applications/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -709,20 +706,17 @@ public okhttp3.Call updateApplicationCall(UUID id, UpdateApplicationRequest upda @SuppressWarnings("rawtypes") private okhttp3.Call updateApplicationValidateBeforeCall(UUID id, UpdateApplicationRequest updateApplicationRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateApplication(Async)"); } - + // verify the required parameter 'updateApplicationRequest' is set if (updateApplicationRequest == null) { throw new ApiException("Missing the required parameter 'updateApplicationRequest' when calling updateApplication(Async)"); } - - okhttp3.Call localVarCall = updateApplicationCall(id, updateApplicationRequest, _callback); - return localVarCall; + return updateApplicationCall(id, updateApplicationRequest, _callback); } @@ -734,7 +728,8 @@ private okhttp3.Call updateApplicationValidateBeforeCall(UUID id, UpdateApplicat * @return Application * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -756,7 +751,8 @@ public Application updateApplication(UUID id, UpdateApplicationRequest updateApp * @return ApiResponse<Application> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -780,7 +776,8 @@ public ApiResponse updateApplicationWithHttpInfo(UUID id, UpdateApp * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/BatchesApi.java b/src/main/java/com/vertexvis/api/BatchesApi.java index 78a443d..50b2ec4 100644 --- a/src/main/java/com/vertexvis/api/BatchesApi.java +++ b/src/main/java/com/vertexvis/api/BatchesApi.java @@ -83,7 +83,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -93,7 +94,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createBatchCall(CreateBatchRequest createBatchRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -139,15 +139,12 @@ public okhttp3.Call createBatchCall(CreateBatchRequest createBatchRequest, final @SuppressWarnings("rawtypes") private okhttp3.Call createBatchValidateBeforeCall(CreateBatchRequest createBatchRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createBatchRequest' is set if (createBatchRequest == null) { throw new ApiException("Missing the required parameter 'createBatchRequest' when calling createBatch(Async)"); } - - okhttp3.Call localVarCall = createBatchCall(createBatchRequest, _callback); - return localVarCall; + return createBatchCall(createBatchRequest, _callback); } @@ -158,7 +155,8 @@ private okhttp3.Call createBatchValidateBeforeCall(CreateBatchRequest createBatc * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -178,7 +176,8 @@ public QueuedJob createBatch(CreateBatchRequest createBatchRequest) throws ApiEx * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -200,7 +199,8 @@ public ApiResponse createBatchWithHttpInfo(CreateBatchRequest createB * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -222,7 +222,8 @@ public okhttp3.Call createBatchAsync(CreateBatchRequest createBatchRequest, fina * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -232,7 +233,6 @@ public okhttp3.Call createBatchAsync(CreateBatchRequest createBatchRequest, fina */ public okhttp3.Call getBatchCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -249,7 +249,7 @@ public okhttp3.Call getBatchCall(UUID id, final ApiCallback _callback) throws Ap // create path and map variables String localVarPath = "/batches/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -266,7 +266,6 @@ public okhttp3.Call getBatchCall(UUID id, final ApiCallback _callback) throws Ap } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -279,15 +278,12 @@ public okhttp3.Call getBatchCall(UUID id, final ApiCallback _callback) throws Ap @SuppressWarnings("rawtypes") private okhttp3.Call getBatchValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getBatch(Async)"); } - - okhttp3.Call localVarCall = getBatchCall(id, _callback); - return localVarCall; + return getBatchCall(id, _callback); } @@ -298,7 +294,8 @@ private okhttp3.Call getBatchValidateBeforeCall(UUID id, final ApiCallback _call * @return Batch * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -318,7 +315,8 @@ public Batch getBatch(UUID id) throws ApiException { * @return ApiResponse<Batch> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -340,7 +338,8 @@ public ApiResponse getBatchWithHttpInfo(UUID id) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -362,7 +361,8 @@ public okhttp3.Call getBatchAsync(UUID id, final ApiCallback _callback) t * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -373,7 +373,6 @@ public okhttp3.Call getBatchAsync(UUID id, final ApiCallback _callback) t */ public okhttp3.Call getQueuedBatchCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -390,7 +389,7 @@ public okhttp3.Call getQueuedBatchCall(UUID id, final ApiCallback _callback) thr // create path and map variables String localVarPath = "/queued-batches/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -407,7 +406,6 @@ public okhttp3.Call getQueuedBatchCall(UUID id, final ApiCallback _callback) thr } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -420,15 +418,12 @@ public okhttp3.Call getQueuedBatchCall(UUID id, final ApiCallback _callback) thr @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedBatchValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedBatch(Async)"); } - - okhttp3.Call localVarCall = getQueuedBatchCall(id, _callback); - return localVarCall; + return getQueuedBatchCall(id, _callback); } @@ -439,7 +434,8 @@ private okhttp3.Call getQueuedBatchValidateBeforeCall(UUID id, final ApiCallback * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -460,7 +456,8 @@ public QueuedJob getQueuedBatch(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -483,7 +480,8 @@ public ApiResponse getQueuedBatchWithHttpInfo(UUID id) throws ApiExce * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ diff --git a/src/main/java/com/vertexvis/api/ExportsApi.java b/src/main/java/com/vertexvis/api/ExportsApi.java index 2191110..b1f01bc 100644 --- a/src/main/java/com/vertexvis/api/ExportsApi.java +++ b/src/main/java/com/vertexvis/api/ExportsApi.java @@ -83,7 +83,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -93,7 +94,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createExportCall(CreateExportRequest createExportRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -139,15 +139,12 @@ public okhttp3.Call createExportCall(CreateExportRequest createExportRequest, fi @SuppressWarnings("rawtypes") private okhttp3.Call createExportValidateBeforeCall(CreateExportRequest createExportRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createExportRequest' is set if (createExportRequest == null) { throw new ApiException("Missing the required parameter 'createExportRequest' when calling createExport(Async)"); } - - okhttp3.Call localVarCall = createExportCall(createExportRequest, _callback); - return localVarCall; + return createExportCall(createExportRequest, _callback); } @@ -158,7 +155,8 @@ private okhttp3.Call createExportValidateBeforeCall(CreateExportRequest createEx * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -178,7 +176,8 @@ public QueuedJob createExport(CreateExportRequest createExportRequest) throws Ap * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -200,7 +199,8 @@ public ApiResponse createExportWithHttpInfo(CreateExportRequest creat * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -222,7 +222,8 @@ public okhttp3.Call createExportAsync(CreateExportRequest createExportRequest, f * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -232,7 +233,6 @@ public okhttp3.Call createExportAsync(CreateExportRequest createExportRequest, f */ public okhttp3.Call getExportCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -249,7 +249,7 @@ public okhttp3.Call getExportCall(UUID id, final ApiCallback _callback) throws A // create path and map variables String localVarPath = "/exports/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -266,7 +266,6 @@ public okhttp3.Call getExportCall(UUID id, final ApiCallback _callback) throws A } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -279,15 +278,12 @@ public okhttp3.Call getExportCall(UUID id, final ApiCallback _callback) throws A @SuppressWarnings("rawtypes") private okhttp3.Call getExportValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getExport(Async)"); } - - okhttp3.Call localVarCall = getExportCall(id, _callback); - return localVarCall; + return getExportCall(id, _callback); } @@ -298,7 +294,8 @@ private okhttp3.Call getExportValidateBeforeCall(UUID id, final ApiCallback _cal * @return Export * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -318,7 +315,8 @@ public Export getExport(UUID id) throws ApiException { * @return ApiResponse<Export> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -340,7 +338,8 @@ public ApiResponse getExportWithHttpInfo(UUID id) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -362,7 +361,8 @@ public okhttp3.Call getExportAsync(UUID id, final ApiCallback _callback) * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -373,7 +373,6 @@ public okhttp3.Call getExportAsync(UUID id, final ApiCallback _callback) */ public okhttp3.Call getQueuedExportCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -390,7 +389,7 @@ public okhttp3.Call getQueuedExportCall(UUID id, final ApiCallback _callback) th // create path and map variables String localVarPath = "/queued-exports/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -407,7 +406,6 @@ public okhttp3.Call getQueuedExportCall(UUID id, final ApiCallback _callback) th } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -420,15 +418,12 @@ public okhttp3.Call getQueuedExportCall(UUID id, final ApiCallback _callback) th @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedExportValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedExport(Async)"); } - - okhttp3.Call localVarCall = getQueuedExportCall(id, _callback); - return localVarCall; + return getQueuedExportCall(id, _callback); } @@ -439,7 +434,8 @@ private okhttp3.Call getQueuedExportValidateBeforeCall(UUID id, final ApiCallbac * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -460,7 +456,8 @@ public QueuedJob getQueuedExport(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -483,7 +480,8 @@ public ApiResponse getQueuedExportWithHttpInfo(UUID id) throws ApiExc * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ diff --git a/src/main/java/com/vertexvis/api/FilesApi.java b/src/main/java/com/vertexvis/api/FilesApi.java index c3da256..40edfe4 100644 --- a/src/main/java/com/vertexvis/api/FilesApi.java +++ b/src/main/java/com/vertexvis/api/FilesApi.java @@ -33,6 +33,7 @@ import com.vertexvis.model.FileList; import com.vertexvis.model.FileMetadata; import java.util.UUID; +import com.vertexvis.model.UpdateFileRequest; import java.lang.reflect.Type; import java.util.ArrayList; @@ -84,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -94,7 +96,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createFileCall(CreateFileRequest createFileRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -140,15 +141,12 @@ public okhttp3.Call createFileCall(CreateFileRequest createFileRequest, final Ap @SuppressWarnings("rawtypes") private okhttp3.Call createFileValidateBeforeCall(CreateFileRequest createFileRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createFileRequest' is set if (createFileRequest == null) { throw new ApiException("Missing the required parameter 'createFileRequest' when calling createFile(Async)"); } - - okhttp3.Call localVarCall = createFileCall(createFileRequest, _callback); - return localVarCall; + return createFileCall(createFileRequest, _callback); } @@ -159,7 +157,8 @@ private okhttp3.Call createFileValidateBeforeCall(CreateFileRequest createFileRe * @return FileMetadata * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -179,7 +178,8 @@ public FileMetadata createFile(CreateFileRequest createFileRequest) throws ApiEx * @return ApiResponse<FileMetadata> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -201,7 +201,8 @@ public ApiResponse createFileWithHttpInfo(CreateFileRequest create * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -223,7 +224,8 @@ public okhttp3.Call createFileAsync(CreateFileRequest createFileRequest, final A * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -233,7 +235,6 @@ public okhttp3.Call createFileAsync(CreateFileRequest createFileRequest, final A */ public okhttp3.Call deleteFileCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -250,7 +251,7 @@ public okhttp3.Call deleteFileCall(UUID id, final ApiCallback _callback) throws // create path and map variables String localVarPath = "/files/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -267,7 +268,6 @@ public okhttp3.Call deleteFileCall(UUID id, final ApiCallback _callback) throws } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -280,15 +280,12 @@ public okhttp3.Call deleteFileCall(UUID id, final ApiCallback _callback) throws @SuppressWarnings("rawtypes") private okhttp3.Call deleteFileValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteFile(Async)"); } - - okhttp3.Call localVarCall = deleteFileCall(id, _callback); - return localVarCall; + return deleteFileCall(id, _callback); } @@ -299,7 +296,8 @@ private okhttp3.Call deleteFileValidateBeforeCall(UUID id, final ApiCallback _ca * @return FileMetadata * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -319,7 +317,8 @@ public FileMetadata deleteFile(UUID id) throws ApiException { * @return ApiResponse<FileMetadata> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -341,7 +340,8 @@ public ApiResponse deleteFileWithHttpInfo(UUID id) throws ApiExcep * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -363,7 +363,8 @@ public okhttp3.Call deleteFileAsync(UUID id, final ApiCallback _ca * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -373,7 +374,6 @@ public okhttp3.Call deleteFileAsync(UUID id, final ApiCallback _ca */ public okhttp3.Call getFileCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -390,7 +390,7 @@ public okhttp3.Call getFileCall(UUID id, final ApiCallback _callback) throws Api // create path and map variables String localVarPath = "/files/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -407,7 +407,6 @@ public okhttp3.Call getFileCall(UUID id, final ApiCallback _callback) throws Api } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -420,15 +419,12 @@ public okhttp3.Call getFileCall(UUID id, final ApiCallback _callback) throws Api @SuppressWarnings("rawtypes") private okhttp3.Call getFileValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getFile(Async)"); } - - okhttp3.Call localVarCall = getFileCall(id, _callback); - return localVarCall; + return getFileCall(id, _callback); } @@ -439,7 +435,8 @@ private okhttp3.Call getFileValidateBeforeCall(UUID id, final ApiCallback _callb * @return FileMetadata * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -459,7 +456,8 @@ public FileMetadata getFile(UUID id) throws ApiException { * @return ApiResponse<FileMetadata> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -481,7 +479,8 @@ public ApiResponse getFileWithHttpInfo(UUID id) throws ApiExceptio * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -505,7 +504,8 @@ public okhttp3.Call getFileAsync(UUID id, final ApiCallback _callb * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -514,7 +514,6 @@ public okhttp3.Call getFileAsync(UUID id, final ApiCallback _callb */ public okhttp3.Call getFilesCall(String pageCursor, Integer pageSize, String filterSuppliedId, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -559,7 +558,6 @@ public okhttp3.Call getFilesCall(String pageCursor, Integer pageSize, String fil } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -572,10 +570,7 @@ public okhttp3.Call getFilesCall(String pageCursor, Integer pageSize, String fil @SuppressWarnings("rawtypes") private okhttp3.Call getFilesValidateBeforeCall(String pageCursor, Integer pageSize, String filterSuppliedId, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getFilesCall(pageCursor, pageSize, filterSuppliedId, _callback); - return localVarCall; + return getFilesCall(pageCursor, pageSize, filterSuppliedId, _callback); } @@ -588,7 +583,8 @@ private okhttp3.Call getFilesValidateBeforeCall(String pageCursor, Integer pageS * @return FileList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -609,7 +605,8 @@ public FileList getFiles(String pageCursor, Integer pageSize, String filterSuppl * @return ApiResponse<FileList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -632,7 +629,8 @@ public ApiResponse getFilesWithHttpInfo(String pageCursor, Integer pag * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -646,6 +644,159 @@ public okhttp3.Call getFilesAsync(String pageCursor, Integer pageSize, String fi localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for updateFile + * @param id The `file` ID. (required) + * @param updateFileRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call updateFileCall(UUID id, UpdateFileRequest updateFileRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateFileRequest; + + // create path and map variables + String localVarPath = "/files/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateFileValidateBeforeCall(UUID id, UpdateFileRequest updateFileRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateFile(Async)"); + } + + // verify the required parameter 'updateFileRequest' is set + if (updateFileRequest == null) { + throw new ApiException("Missing the required parameter 'updateFileRequest' when calling updateFile(Async)"); + } + + return updateFileCall(id, updateFileRequest, _callback); + + } + + /** + * + * Update a `file`. + * @param id The `file` ID. (required) + * @param updateFileRequest (required) + * @return FileMetadata + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public FileMetadata updateFile(UUID id, UpdateFileRequest updateFileRequest) throws ApiException { + ApiResponse localVarResp = updateFileWithHttpInfo(id, updateFileRequest); + return localVarResp.getData(); + } + + /** + * + * Update a `file`. + * @param id The `file` ID. (required) + * @param updateFileRequest (required) + * @return ApiResponse<FileMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse updateFileWithHttpInfo(UUID id, UpdateFileRequest updateFileRequest) throws ApiException { + okhttp3.Call localVarCall = updateFileValidateBeforeCall(id, updateFileRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Update a `file`. + * @param id The `file` ID. (required) + * @param updateFileRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call updateFileAsync(UUID id, UpdateFileRequest updateFileRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateFileValidateBeforeCall(id, updateFileRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for uploadFile * @param id The `file` ID. (required) @@ -654,7 +805,8 @@ public okhttp3.Call getFilesAsync(String pageCursor, Integer pageSize, String fi * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -665,7 +817,6 @@ public okhttp3.Call getFilesAsync(String pageCursor, Integer pageSize, String fi */ public okhttp3.Call uploadFileCall(UUID id, File body, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -682,7 +833,7 @@ public okhttp3.Call uploadFileCall(UUID id, File body, final ApiCallback _callba // create path and map variables String localVarPath = "/files/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -712,20 +863,17 @@ public okhttp3.Call uploadFileCall(UUID id, File body, final ApiCallback _callba @SuppressWarnings("rawtypes") private okhttp3.Call uploadFileValidateBeforeCall(UUID id, File body, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling uploadFile(Async)"); } - + // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling uploadFile(Async)"); } - - okhttp3.Call localVarCall = uploadFileCall(id, body, _callback); - return localVarCall; + return uploadFileCall(id, body, _callback); } @@ -736,7 +884,8 @@ private okhttp3.Call uploadFileValidateBeforeCall(UUID id, File body, final ApiC * @param body (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
+
+ @@ -757,7 +906,8 @@ public void uploadFile(UUID id, File body) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
+
+ @@ -780,7 +930,8 @@ public ApiResponse uploadFileWithHttpInfo(UUID id, File body) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/GeometrySetsApi.java b/src/main/java/com/vertexvis/api/GeometrySetsApi.java index 2e55ef5..fe541f4 100644 --- a/src/main/java/com/vertexvis/api/GeometrySetsApi.java +++ b/src/main/java/com/vertexvis/api/GeometrySetsApi.java @@ -84,7 +84,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
+
+ @@ -94,7 +95,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createGeometrySetCall(CreateGeometrySetRequest createGeometrySetRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -140,15 +140,12 @@ public okhttp3.Call createGeometrySetCall(CreateGeometrySetRequest createGeometr @SuppressWarnings("rawtypes") private okhttp3.Call createGeometrySetValidateBeforeCall(CreateGeometrySetRequest createGeometrySetRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createGeometrySetRequest' is set if (createGeometrySetRequest == null) { throw new ApiException("Missing the required parameter 'createGeometrySetRequest' when calling createGeometrySet(Async)"); } - - okhttp3.Call localVarCall = createGeometrySetCall(createGeometrySetRequest, _callback); - return localVarCall; + return createGeometrySetCall(createGeometrySetRequest, _callback); } @@ -159,7 +156,8 @@ private okhttp3.Call createGeometrySetValidateBeforeCall(CreateGeometrySetReques * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -179,7 +177,8 @@ public QueuedJob createGeometrySet(CreateGeometrySetRequest createGeometrySetReq * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -201,7 +200,8 @@ public ApiResponse createGeometrySetWithHttpInfo(CreateGeometrySetReq * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -223,7 +223,8 @@ public okhttp3.Call createGeometrySetAsync(CreateGeometrySetRequest createGeomet * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -233,7 +234,6 @@ public okhttp3.Call createGeometrySetAsync(CreateGeometrySetRequest createGeomet */ public okhttp3.Call getGeometrySetCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -250,7 +250,7 @@ public okhttp3.Call getGeometrySetCall(UUID id, final ApiCallback _callback) thr // create path and map variables String localVarPath = "/geometry-sets/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -267,7 +267,6 @@ public okhttp3.Call getGeometrySetCall(UUID id, final ApiCallback _callback) thr } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -280,15 +279,12 @@ public okhttp3.Call getGeometrySetCall(UUID id, final ApiCallback _callback) thr @SuppressWarnings("rawtypes") private okhttp3.Call getGeometrySetValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getGeometrySet(Async)"); } - - okhttp3.Call localVarCall = getGeometrySetCall(id, _callback); - return localVarCall; + return getGeometrySetCall(id, _callback); } @@ -299,7 +295,8 @@ private okhttp3.Call getGeometrySetValidateBeforeCall(UUID id, final ApiCallback * @return GeometrySet * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -319,7 +316,8 @@ public GeometrySet getGeometrySet(UUID id) throws ApiException { * @return ApiResponse<GeometrySet> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -341,7 +339,8 @@ public ApiResponse getGeometrySetWithHttpInfo(UUID id) throws ApiEx * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -364,7 +363,8 @@ public okhttp3.Call getGeometrySetAsync(UUID id, final ApiCallback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -373,7 +373,6 @@ public okhttp3.Call getGeometrySetAsync(UUID id, final ApiCallback */ public okhttp3.Call getGeometrySetsCall(String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -414,7 +413,6 @@ public okhttp3.Call getGeometrySetsCall(String pageCursor, Integer pageSize, fin } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -427,10 +425,7 @@ public okhttp3.Call getGeometrySetsCall(String pageCursor, Integer pageSize, fin @SuppressWarnings("rawtypes") private okhttp3.Call getGeometrySetsValidateBeforeCall(String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getGeometrySetsCall(pageCursor, pageSize, _callback); - return localVarCall; + return getGeometrySetsCall(pageCursor, pageSize, _callback); } @@ -442,7 +437,8 @@ private okhttp3.Call getGeometrySetsValidateBeforeCall(String pageCursor, Intege * @return GeometrySetList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -462,7 +458,8 @@ public GeometrySetList getGeometrySets(String pageCursor, Integer pageSize) thro * @return ApiResponse<GeometrySetList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -484,7 +481,8 @@ public ApiResponse getGeometrySetsWithHttpInfo(String pageCurso * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/HitsApi.java b/src/main/java/com/vertexvis/api/HitsApi.java index ac1c089..02f5b45 100644 --- a/src/main/java/com/vertexvis/api/HitsApi.java +++ b/src/main/java/com/vertexvis/api/HitsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -96,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneHitCall(UUID id, CreateHitRequest createHitRequest, String include, String fieldsPartRevision, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -113,7 +113,7 @@ public okhttp3.Call createSceneHitCall(UUID id, CreateHitRequest createHitReques // create path and map variables String localVarPath = "/scenes/{id}/hits" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -151,20 +151,17 @@ public okhttp3.Call createSceneHitCall(UUID id, CreateHitRequest createHitReques @SuppressWarnings("rawtypes") private okhttp3.Call createSceneHitValidateBeforeCall(UUID id, CreateHitRequest createHitRequest, String include, String fieldsPartRevision, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneHit(Async)"); } - + // verify the required parameter 'createHitRequest' is set if (createHitRequest == null) { throw new ApiException("Missing the required parameter 'createHitRequest' when calling createSceneHit(Async)"); } - - okhttp3.Call localVarCall = createSceneHitCall(id, createHitRequest, include, fieldsPartRevision, _callback); - return localVarCall; + return createSceneHitCall(id, createHitRequest, include, fieldsPartRevision, _callback); } @@ -178,7 +175,8 @@ private okhttp3.Call createSceneHitValidateBeforeCall(UUID id, CreateHitRequest * @return Hit * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -202,7 +200,8 @@ public Hit createSceneHit(UUID id, CreateHitRequest createHitRequest, String inc * @return ApiResponse<Hit> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -228,7 +227,8 @@ public ApiResponse createSceneHitWithHttpInfo(UUID id, CreateHitRequest cre * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -254,7 +254,8 @@ public okhttp3.Call createSceneHitAsync(UUID id, CreateHitRequest createHitReque * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -265,7 +266,6 @@ public okhttp3.Call createSceneHitAsync(UUID id, CreateHitRequest createHitReque */ public okhttp3.Call createSceneViewHitCall(UUID id, CreateHitRequest createHitRequest, String include, String fieldsPartRevision, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -282,7 +282,7 @@ public okhttp3.Call createSceneViewHitCall(UUID id, CreateHitRequest createHitRe // create path and map variables String localVarPath = "/scene-views/{id}/hits" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -320,20 +320,17 @@ public okhttp3.Call createSceneViewHitCall(UUID id, CreateHitRequest createHitRe @SuppressWarnings("rawtypes") private okhttp3.Call createSceneViewHitValidateBeforeCall(UUID id, CreateHitRequest createHitRequest, String include, String fieldsPartRevision, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneViewHit(Async)"); } - + // verify the required parameter 'createHitRequest' is set if (createHitRequest == null) { throw new ApiException("Missing the required parameter 'createHitRequest' when calling createSceneViewHit(Async)"); } - - okhttp3.Call localVarCall = createSceneViewHitCall(id, createHitRequest, include, fieldsPartRevision, _callback); - return localVarCall; + return createSceneViewHitCall(id, createHitRequest, include, fieldsPartRevision, _callback); } @@ -347,7 +344,8 @@ private okhttp3.Call createSceneViewHitValidateBeforeCall(UUID id, CreateHitRequ * @return Hit * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -371,7 +369,8 @@ public Hit createSceneViewHit(UUID id, CreateHitRequest createHitRequest, String * @return ApiResponse<Hit> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -397,7 +396,8 @@ public ApiResponse createSceneViewHitWithHttpInfo(UUID id, CreateHitRequest * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/ModelViewsApi.java b/src/main/java/com/vertexvis/api/ModelViewsApi.java new file mode 100644 index 0000000..978ba52 --- /dev/null +++ b/src/main/java/com/vertexvis/api/ModelViewsApi.java @@ -0,0 +1,543 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.api; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.ApiResponse; +import com.vertexvis.Configuration; +import com.vertexvis.Pair; +import com.vertexvis.ProgressRequestBody; +import com.vertexvis.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.vertexvis.model.Failure; +import com.vertexvis.model.ModelView; +import com.vertexvis.model.ModelViewList; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ModelViewsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ModelViewsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ModelViewsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getModelView + * @param id The `model-view` ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+ + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getModelViewCall(UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/model-views/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getModelViewValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getModelView(Async)"); + } + + return getModelViewCall(id, _callback); + + } + + /** + * + * Get the details of a `model-view`. + * @param id The `model-view` ID. (required) + * @return ModelView + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ModelView getModelView(UUID id) throws ApiException { + ApiResponse localVarResp = getModelViewWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * + * Get the details of a `model-view`. + * @param id The `model-view` ID. (required) + * @return ApiResponse<ModelView> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getModelViewWithHttpInfo(UUID id) throws ApiException { + okhttp3.Call localVarCall = getModelViewValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get the details of a `model-view`. + * @param id The `model-view` ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getModelViewAsync(UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getModelViewValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPartRevisionModelViews + * @param id The `part-revision` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPartRevisionModelViewsCall(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/part-revisions/{id}/model-views" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filterHasAnnotations != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[hasAnnotations]", filterHasAnnotations)); + } + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPartRevisionModelViewsValidateBeforeCall(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getPartRevisionModelViews(Async)"); + } + + return getPartRevisionModelViewsCall(id, filterHasAnnotations, pageCursor, pageSize, _callback); + + } + + /** + * + * Get a paged list of `model-views` for a part revision. + * @param id The `part-revision` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ModelViewList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ModelViewList getPartRevisionModelViews(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize) throws ApiException { + ApiResponse localVarResp = getPartRevisionModelViewsWithHttpInfo(id, filterHasAnnotations, pageCursor, pageSize); + return localVarResp.getData(); + } + + /** + * + * Get a paged list of `model-views` for a part revision. + * @param id The `part-revision` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ApiResponse<ModelViewList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getPartRevisionModelViewsWithHttpInfo(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getPartRevisionModelViewsValidateBeforeCall(id, filterHasAnnotations, pageCursor, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a paged list of `model-views` for a part revision. + * @param id The `part-revision` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPartRevisionModelViewsAsync(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPartRevisionModelViewsValidateBeforeCall(id, filterHasAnnotations, pageCursor, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSceneItemModelViews + * @param id The `scene-item` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getSceneItemModelViewsCall(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/scene-items/{id}/model-views" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filterHasAnnotations != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[hasAnnotations]", filterHasAnnotations)); + } + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSceneItemModelViewsValidateBeforeCall(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getSceneItemModelViews(Async)"); + } + + return getSceneItemModelViewsCall(id, filterHasAnnotations, pageCursor, pageSize, _callback); + + } + + /** + * + * Get a paged list of `model-views` for a scene item. + * @param id The `scene-item` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ModelViewList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ModelViewList getSceneItemModelViews(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize) throws ApiException { + ApiResponse localVarResp = getSceneItemModelViewsWithHttpInfo(id, filterHasAnnotations, pageCursor, pageSize); + return localVarResp.getData(); + } + + /** + * + * Get a paged list of `model-views` for a scene item. + * @param id The `scene-item` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ApiResponse<ModelViewList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getSceneItemModelViewsWithHttpInfo(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getSceneItemModelViewsValidateBeforeCall(id, filterHasAnnotations, pageCursor, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a paged list of `model-views` for a scene item. + * @param id The `scene-item` ID. (required) + * @param filterHasAnnotations Filter model views that contain or do not contain annotations. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getSceneItemModelViewsAsync(UUID id, Boolean filterHasAnnotations, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSceneItemModelViewsValidateBeforeCall(id, filterHasAnnotations, pageCursor, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/vertexvis/api/Oauth2Api.java b/src/main/java/com/vertexvis/api/Oauth2Api.java index a5b2abe..edab46d 100644 --- a/src/main/java/com/vertexvis/api/Oauth2Api.java +++ b/src/main/java/com/vertexvis/api/Oauth2Api.java @@ -86,7 +86,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -95,7 +96,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call adminAcceptConsentCall(String challenge, AdminConsentAcceptRequest adminConsentAcceptRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -145,15 +145,12 @@ public okhttp3.Call adminAcceptConsentCall(String challenge, AdminConsentAcceptR @SuppressWarnings("rawtypes") private okhttp3.Call adminAcceptConsentValidateBeforeCall(String challenge, AdminConsentAcceptRequest adminConsentAcceptRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'challenge' is set if (challenge == null) { throw new ApiException("Missing the required parameter 'challenge' when calling adminAcceptConsent(Async)"); } - - okhttp3.Call localVarCall = adminAcceptConsentCall(challenge, adminConsentAcceptRequest, _callback); - return localVarCall; + return adminAcceptConsentCall(challenge, adminConsentAcceptRequest, _callback); } @@ -165,7 +162,8 @@ private okhttp3.Call adminAcceptConsentValidateBeforeCall(String challenge, Admi * @return AdminRedirectTo * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -185,7 +183,8 @@ public AdminRedirectTo adminAcceptConsent(String challenge, AdminConsentAcceptRe * @return ApiResponse<AdminRedirectTo> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -207,7 +206,8 @@ public ApiResponse adminAcceptConsentWithHttpInfo(String challe * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -229,7 +229,8 @@ public okhttp3.Call adminAcceptConsentAsync(String challenge, AdminConsentAccept * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -238,7 +239,6 @@ public okhttp3.Call adminAcceptConsentAsync(String challenge, AdminConsentAccept */ public okhttp3.Call adminAcceptLoginCall(String loginChallenge, AdminLoginAcceptRequest adminLoginAcceptRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -288,20 +288,17 @@ public okhttp3.Call adminAcceptLoginCall(String loginChallenge, AdminLoginAccept @SuppressWarnings("rawtypes") private okhttp3.Call adminAcceptLoginValidateBeforeCall(String loginChallenge, AdminLoginAcceptRequest adminLoginAcceptRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'loginChallenge' is set if (loginChallenge == null) { throw new ApiException("Missing the required parameter 'loginChallenge' when calling adminAcceptLogin(Async)"); } - + // verify the required parameter 'adminLoginAcceptRequest' is set if (adminLoginAcceptRequest == null) { throw new ApiException("Missing the required parameter 'adminLoginAcceptRequest' when calling adminAcceptLogin(Async)"); } - - okhttp3.Call localVarCall = adminAcceptLoginCall(loginChallenge, adminLoginAcceptRequest, _callback); - return localVarCall; + return adminAcceptLoginCall(loginChallenge, adminLoginAcceptRequest, _callback); } @@ -313,7 +310,8 @@ private okhttp3.Call adminAcceptLoginValidateBeforeCall(String loginChallenge, A * @return AdminRedirectTo * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -333,7 +331,8 @@ public AdminRedirectTo adminAcceptLogin(String loginChallenge, AdminLoginAcceptR * @return ApiResponse<AdminRedirectTo> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -355,7 +354,8 @@ public ApiResponse adminAcceptLoginWithHttpInfo(String loginCha * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -380,7 +380,8 @@ public okhttp3.Call adminAcceptLoginAsync(String loginChallenge, AdminLoginAccep * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -388,7 +389,6 @@ public okhttp3.Call adminAcceptLoginAsync(String loginChallenge, AdminLoginAccep */ public okhttp3.Call createTokenCall(String grantType, String scope, String code, String redirectUri, String refreshToken, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -454,15 +454,12 @@ public okhttp3.Call createTokenCall(String grantType, String scope, String code, @SuppressWarnings("rawtypes") private okhttp3.Call createTokenValidateBeforeCall(String grantType, String scope, String code, String redirectUri, String refreshToken, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'grantType' is set if (grantType == null) { throw new ApiException("Missing the required parameter 'grantType' when calling createToken(Async)"); } - - okhttp3.Call localVarCall = createTokenCall(grantType, scope, code, redirectUri, refreshToken, _callback); - return localVarCall; + return createTokenCall(grantType, scope, code, redirectUri, refreshToken, _callback); } @@ -477,7 +474,8 @@ private okhttp3.Call createTokenValidateBeforeCall(String grantType, String scop * @return OAuth2Token * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Invalid or missing request. -
+
+ @@ -499,7 +497,8 @@ public OAuth2Token createToken(String grantType, String scope, String code, Stri * @return ApiResponse<OAuth2Token> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Invalid or missing request. -
+
+ @@ -523,7 +522,8 @@ public ApiResponse createTokenWithHttpInfo(String grantType, String * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Invalid or missing request. -
+
+ @@ -543,14 +543,14 @@ public okhttp3.Call createTokenAsync(String grantType, String scope, String code * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Invalid or missing request. -
+
+
Response Details
Status Code Description Response Headers
204 No Content -
*/ public okhttp3.Call revokeTokenCall(RevokeOAuth2TokenRequest revokeOAuth2TokenRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -575,7 +575,6 @@ public okhttp3.Call revokeTokenCall(RevokeOAuth2TokenRequest revokeOAuth2TokenRe Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -596,15 +595,12 @@ public okhttp3.Call revokeTokenCall(RevokeOAuth2TokenRequest revokeOAuth2TokenRe @SuppressWarnings("rawtypes") private okhttp3.Call revokeTokenValidateBeforeCall(RevokeOAuth2TokenRequest revokeOAuth2TokenRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'revokeOAuth2TokenRequest' is set if (revokeOAuth2TokenRequest == null) { throw new ApiException("Missing the required parameter 'revokeOAuth2TokenRequest' when calling revokeToken(Async)"); } - - okhttp3.Call localVarCall = revokeTokenCall(revokeOAuth2TokenRequest, _callback); - return localVarCall; + return revokeTokenCall(revokeOAuth2TokenRequest, _callback); } @@ -614,7 +610,8 @@ private okhttp3.Call revokeTokenValidateBeforeCall(RevokeOAuth2TokenRequest revo * @param revokeOAuth2TokenRequest (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
204 No Content -
@@ -630,7 +627,8 @@ public void revokeToken(RevokeOAuth2TokenRequest revokeOAuth2TokenRequest) throw * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
204 No Content -
@@ -648,7 +646,8 @@ public ApiResponse revokeTokenWithHttpInfo(RevokeOAuth2TokenRequest revoke * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
204 No Content -
diff --git a/src/main/java/com/vertexvis/api/PartRenditionsApi.java b/src/main/java/com/vertexvis/api/PartRenditionsApi.java index b10fc50..4b5ca4a 100644 --- a/src/main/java/com/vertexvis/api/PartRenditionsApi.java +++ b/src/main/java/com/vertexvis/api/PartRenditionsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -97,7 +98,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createPartRenditionCall(UUID id, CreatePartRenditionRequest createPartRenditionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -114,7 +114,7 @@ public okhttp3.Call createPartRenditionCall(UUID id, CreatePartRenditionRequest // create path and map variables String localVarPath = "/part-revisions/{id}/part-renditions" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -144,20 +144,17 @@ public okhttp3.Call createPartRenditionCall(UUID id, CreatePartRenditionRequest @SuppressWarnings("rawtypes") private okhttp3.Call createPartRenditionValidateBeforeCall(UUID id, CreatePartRenditionRequest createPartRenditionRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createPartRendition(Async)"); } - + // verify the required parameter 'createPartRenditionRequest' is set if (createPartRenditionRequest == null) { throw new ApiException("Missing the required parameter 'createPartRenditionRequest' when calling createPartRendition(Async)"); } - - okhttp3.Call localVarCall = createPartRenditionCall(id, createPartRenditionRequest, _callback); - return localVarCall; + return createPartRenditionCall(id, createPartRenditionRequest, _callback); } @@ -169,7 +166,8 @@ private okhttp3.Call createPartRenditionValidateBeforeCall(UUID id, CreatePartRe * @return PartRendition * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -192,7 +190,8 @@ public PartRendition createPartRendition(UUID id, CreatePartRenditionRequest cre * @return ApiResponse<PartRendition> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -217,7 +216,8 @@ public ApiResponse createPartRenditionWithHttpInfo(UUID id, Creat * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -241,7 +241,8 @@ public okhttp3.Call createPartRenditionAsync(UUID id, CreatePartRenditionRequest * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -251,7 +252,6 @@ public okhttp3.Call createPartRenditionAsync(UUID id, CreatePartRenditionRequest */ public okhttp3.Call getPartRenditionCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -268,7 +268,7 @@ public okhttp3.Call getPartRenditionCall(UUID id, final ApiCallback _callback) t // create path and map variables String localVarPath = "/part-renditions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -285,7 +285,6 @@ public okhttp3.Call getPartRenditionCall(UUID id, final ApiCallback _callback) t } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -298,15 +297,12 @@ public okhttp3.Call getPartRenditionCall(UUID id, final ApiCallback _callback) t @SuppressWarnings("rawtypes") private okhttp3.Call getPartRenditionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getPartRendition(Async)"); } - - okhttp3.Call localVarCall = getPartRenditionCall(id, _callback); - return localVarCall; + return getPartRenditionCall(id, _callback); } @@ -317,7 +313,8 @@ private okhttp3.Call getPartRenditionValidateBeforeCall(UUID id, final ApiCallba * @return PartRendition * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -337,7 +334,8 @@ public PartRendition getPartRendition(UUID id) throws ApiException { * @return ApiResponse<PartRendition> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -359,7 +357,8 @@ public ApiResponse getPartRenditionWithHttpInfo(UUID id) throws A * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -384,7 +383,8 @@ public okhttp3.Call getPartRenditionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -393,7 +393,6 @@ public okhttp3.Call getPartRenditionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -494,7 +490,8 @@ public PartRenditionList getPartRenditions(String pageCursor, Integer pageSize, * @return ApiResponse<PartRenditionList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -518,7 +515,8 @@ public ApiResponse getPartRenditionsWithHttpInfo(String pageC * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/PartRevisionInstancesApi.java b/src/main/java/com/vertexvis/api/PartRevisionInstancesApi.java new file mode 100644 index 0000000..c29c25d --- /dev/null +++ b/src/main/java/com/vertexvis/api/PartRevisionInstancesApi.java @@ -0,0 +1,234 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.api; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.ApiResponse; +import com.vertexvis.Configuration; +import com.vertexvis.Pair; +import com.vertexvis.ProgressRequestBody; +import com.vertexvis.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.vertexvis.model.Failure; +import com.vertexvis.model.PartRevisionInstanceList; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PartRevisionInstancesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PartRevisionInstancesApi() { + this(Configuration.getDefaultApiClient()); + } + + public PartRevisionInstancesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPartRevisionInstanceList + * @param filterParent Parent ID to filter on. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPartRevisionInstanceListCall(UUID filterParent, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/part-revision-instances"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filterParent != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[parent]", filterParent)); + } + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPartRevisionInstanceListValidateBeforeCall(UUID filterParent, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + return getPartRevisionInstanceListCall(filterParent, pageCursor, pageSize, _callback); + + } + + /** + * + * Gets a page of 'part-revision' instances. An instance is an occurence of a revision that is a child of a parent revision. The returned data will have the ordinal used for ordering and the transform matrix for each occurrence. + * @param filterParent Parent ID to filter on. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return PartRevisionInstanceList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public PartRevisionInstanceList getPartRevisionInstanceList(UUID filterParent, String pageCursor, Integer pageSize) throws ApiException { + ApiResponse localVarResp = getPartRevisionInstanceListWithHttpInfo(filterParent, pageCursor, pageSize); + return localVarResp.getData(); + } + + /** + * + * Gets a page of 'part-revision' instances. An instance is an occurence of a revision that is a child of a parent revision. The returned data will have the ordinal used for ordering and the transform matrix for each occurrence. + * @param filterParent Parent ID to filter on. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ApiResponse<PartRevisionInstanceList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getPartRevisionInstanceListWithHttpInfo(UUID filterParent, String pageCursor, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getPartRevisionInstanceListValidateBeforeCall(filterParent, pageCursor, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Gets a page of 'part-revision' instances. An instance is an occurence of a revision that is a child of a parent revision. The returned data will have the ordinal used for ordering and the transform matrix for each occurrence. + * @param filterParent Parent ID to filter on. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPartRevisionInstanceListAsync(UUID filterParent, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPartRevisionInstanceListValidateBeforeCall(filterParent, pageCursor, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/vertexvis/api/PartRevisionsApi.java b/src/main/java/com/vertexvis/api/PartRevisionsApi.java index 636f3b6..27f4af6 100644 --- a/src/main/java/com/vertexvis/api/PartRevisionsApi.java +++ b/src/main/java/com/vertexvis/api/PartRevisionsApi.java @@ -87,7 +87,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -97,7 +98,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call deletePartRevisionCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -114,7 +114,7 @@ public okhttp3.Call deletePartRevisionCall(UUID id, final ApiCallback _callback) // create path and map variables String localVarPath = "/part-revisions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -131,7 +131,6 @@ public okhttp3.Call deletePartRevisionCall(UUID id, final ApiCallback _callback) } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -144,15 +143,12 @@ public okhttp3.Call deletePartRevisionCall(UUID id, final ApiCallback _callback) @SuppressWarnings("rawtypes") private okhttp3.Call deletePartRevisionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deletePartRevision(Async)"); } - - okhttp3.Call localVarCall = deletePartRevisionCall(id, _callback); - return localVarCall; + return deletePartRevisionCall(id, _callback); } @@ -163,7 +159,8 @@ private okhttp3.Call deletePartRevisionValidateBeforeCall(UUID id, final ApiCall * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -183,7 +180,8 @@ public QueuedJob deletePartRevision(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -205,7 +203,8 @@ public ApiResponse deletePartRevisionWithHttpInfo(UUID id) throws Api * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -228,7 +227,8 @@ public okhttp3.Call deletePartRevisionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+ @@ -238,7 +238,6 @@ public okhttp3.Call deletePartRevisionAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -276,7 +275,6 @@ public okhttp3.Call getPartRevisionCall(UUID id, String fieldsPartRevision, fina } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -289,15 +287,12 @@ public okhttp3.Call getPartRevisionCall(UUID id, String fieldsPartRevision, fina @SuppressWarnings("rawtypes") private okhttp3.Call getPartRevisionValidateBeforeCall(UUID id, String fieldsPartRevision, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getPartRevision(Async)"); } - - okhttp3.Call localVarCall = getPartRevisionCall(id, fieldsPartRevision, _callback); - return localVarCall; + return getPartRevisionCall(id, fieldsPartRevision, _callback); } @@ -309,7 +304,8 @@ private okhttp3.Call getPartRevisionValidateBeforeCall(UUID id, String fieldsPar * @return PartRevision * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -330,7 +326,8 @@ public PartRevision getPartRevision(UUID id, String fieldsPartRevision) throws A * @return ApiResponse<PartRevision> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -353,7 +350,8 @@ public ApiResponse getPartRevisionWithHttpInfo(UUID id, String fie * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -378,7 +376,8 @@ public okhttp3.Call getPartRevisionAsync(UUID id, String fieldsPartRevision, fin * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -388,7 +387,6 @@ public okhttp3.Call getPartRevisionAsync(UUID id, String fieldsPartRevision, fin */ public okhttp3.Call getPartRevisionsCall(UUID id, String pageCursor, Integer pageSize, String filterSuppliedId, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -405,7 +403,7 @@ public okhttp3.Call getPartRevisionsCall(UUID id, String pageCursor, Integer pag // create path and map variables String localVarPath = "/parts/{id}/part-revisions" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -434,7 +432,6 @@ public okhttp3.Call getPartRevisionsCall(UUID id, String pageCursor, Integer pag } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -447,15 +444,12 @@ public okhttp3.Call getPartRevisionsCall(UUID id, String pageCursor, Integer pag @SuppressWarnings("rawtypes") private okhttp3.Call getPartRevisionsValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, String filterSuppliedId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getPartRevisions(Async)"); } - - okhttp3.Call localVarCall = getPartRevisionsCall(id, pageCursor, pageSize, filterSuppliedId, _callback); - return localVarCall; + return getPartRevisionsCall(id, pageCursor, pageSize, filterSuppliedId, _callback); } @@ -469,7 +463,8 @@ private okhttp3.Call getPartRevisionsValidateBeforeCall(UUID id, String pageCurs * @return PartRevisionList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -492,7 +487,8 @@ public PartRevisionList getPartRevisions(UUID id, String pageCursor, Integer pag * @return ApiResponse<PartRevisionList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -517,7 +513,8 @@ public ApiResponse getPartRevisionsWithHttpInfo(UUID id, Strin * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -539,7 +536,8 @@ public okhttp3.Call getPartRevisionsAsync(UUID id, String pageCursor, Integer pa * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -549,7 +547,6 @@ public okhttp3.Call getPartRevisionsAsync(UUID id, String pageCursor, Integer pa */ public okhttp3.Call getQueuedPartRevisionDeletionCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -566,7 +563,7 @@ public okhttp3.Call getQueuedPartRevisionDeletionCall(UUID id, final ApiCallback // create path and map variables String localVarPath = "/queued-part-revision-deletions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -583,7 +580,6 @@ public okhttp3.Call getQueuedPartRevisionDeletionCall(UUID id, final ApiCallback } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -596,15 +592,12 @@ public okhttp3.Call getQueuedPartRevisionDeletionCall(UUID id, final ApiCallback @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedPartRevisionDeletionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedPartRevisionDeletion(Async)"); } - - okhttp3.Call localVarCall = getQueuedPartRevisionDeletionCall(id, _callback); - return localVarCall; + return getQueuedPartRevisionDeletionCall(id, _callback); } @@ -615,7 +608,8 @@ private okhttp3.Call getQueuedPartRevisionDeletionValidateBeforeCall(UUID id, fi * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -635,7 +629,8 @@ public QueuedJob getQueuedPartRevisionDeletion(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -657,7 +652,8 @@ public ApiResponse getQueuedPartRevisionDeletionWithHttpInfo(UUID id) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -691,7 +687,8 @@ public okhttp3.Call getQueuedPartRevisionDeletionAsync(UUID id, final ApiCallbac * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -702,7 +699,6 @@ public okhttp3.Call getQueuedPartRevisionDeletionAsync(UUID id, final ApiCallbac */ public okhttp3.Call renderPartRevisionCall(UUID id, Integer height, Integer width, Vector3 cameraPosition, Vector3 cameraUp, Vector3 cameraLookAt, Vector3 cameraPerspectivePosition, Vector3 cameraPerspectiveLookAt, Vector3 cameraPerspectiveUp, Vector3 cameraOrthographicViewVector, Vector3 cameraOrthographicLookAt, Vector3 cameraOrthographicUp, BigDecimal cameraOrthographicFovHeight, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -719,7 +715,7 @@ public okhttp3.Call renderPartRevisionCall(UUID id, Integer height, Integer widt // create path and map variables String localVarPath = "/part-revisions/{id}/image" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -776,7 +772,9 @@ public okhttp3.Call renderPartRevisionCall(UUID id, Integer height, Integer widt } final String[] localVarAccepts = { - "image/jpeg", "image/png", "application/vnd.api+json" + "image/jpeg", + "image/png", + "application/vnd.api+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -784,7 +782,6 @@ public okhttp3.Call renderPartRevisionCall(UUID id, Integer height, Integer widt } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -797,15 +794,12 @@ public okhttp3.Call renderPartRevisionCall(UUID id, Integer height, Integer widt @SuppressWarnings("rawtypes") private okhttp3.Call renderPartRevisionValidateBeforeCall(UUID id, Integer height, Integer width, Vector3 cameraPosition, Vector3 cameraUp, Vector3 cameraLookAt, Vector3 cameraPerspectivePosition, Vector3 cameraPerspectiveLookAt, Vector3 cameraPerspectiveUp, Vector3 cameraOrthographicViewVector, Vector3 cameraOrthographicLookAt, Vector3 cameraOrthographicUp, BigDecimal cameraOrthographicFovHeight, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling renderPartRevision(Async)"); } - - okhttp3.Call localVarCall = renderPartRevisionCall(id, height, width, cameraPosition, cameraUp, cameraLookAt, cameraPerspectivePosition, cameraPerspectiveLookAt, cameraPerspectiveUp, cameraOrthographicViewVector, cameraOrthographicLookAt, cameraOrthographicUp, cameraOrthographicFovHeight, _callback); - return localVarCall; + return renderPartRevisionCall(id, height, width, cameraPosition, cameraUp, cameraLookAt, cameraPerspectivePosition, cameraPerspectiveLookAt, cameraPerspectiveUp, cameraOrthographicViewVector, cameraOrthographicLookAt, cameraOrthographicUp, cameraOrthographicFovHeight, _callback); } @@ -828,7 +822,8 @@ private okhttp3.Call renderPartRevisionValidateBeforeCall(UUID id, Integer heigh * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -861,7 +856,8 @@ public File renderPartRevision(UUID id, Integer height, Integer width, Vector3 c * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -896,7 +892,8 @@ public ApiResponse renderPartRevisionWithHttpInfo(UUID id, Integer height, * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -920,7 +917,8 @@ public okhttp3.Call renderPartRevisionAsync(UUID id, Integer height, Integer wid * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -932,7 +930,6 @@ public okhttp3.Call renderPartRevisionAsync(UUID id, Integer height, Integer wid */ public okhttp3.Call updatePartRevisionCall(UUID id, UpdatePartRevisionRequest updatePartRevisionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -949,7 +946,7 @@ public okhttp3.Call updatePartRevisionCall(UUID id, UpdatePartRevisionRequest up // create path and map variables String localVarPath = "/part-revisions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -979,20 +976,17 @@ public okhttp3.Call updatePartRevisionCall(UUID id, UpdatePartRevisionRequest up @SuppressWarnings("rawtypes") private okhttp3.Call updatePartRevisionValidateBeforeCall(UUID id, UpdatePartRevisionRequest updatePartRevisionRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updatePartRevision(Async)"); } - + // verify the required parameter 'updatePartRevisionRequest' is set if (updatePartRevisionRequest == null) { throw new ApiException("Missing the required parameter 'updatePartRevisionRequest' when calling updatePartRevision(Async)"); } - - okhttp3.Call localVarCall = updatePartRevisionCall(id, updatePartRevisionRequest, _callback); - return localVarCall; + return updatePartRevisionCall(id, updatePartRevisionRequest, _callback); } @@ -1004,7 +998,8 @@ private okhttp3.Call updatePartRevisionValidateBeforeCall(UUID id, UpdatePartRev * @return PartRevision * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -1027,7 +1022,8 @@ public PartRevision updatePartRevision(UUID id, UpdatePartRevisionRequest update * @return ApiResponse<PartRevision> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -1052,7 +1048,8 @@ public ApiResponse updatePartRevisionWithHttpInfo(UUID id, UpdateP * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ diff --git a/src/main/java/com/vertexvis/api/PartsApi.java b/src/main/java/com/vertexvis/api/PartsApi.java index 71c1177..d0b1ebd 100644 --- a/src/main/java/com/vertexvis/api/PartsApi.java +++ b/src/main/java/com/vertexvis/api/PartsApi.java @@ -84,7 +84,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
202 Accepted * content-location -
+
+ @@ -95,7 +96,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createPartCall(CreatePartRequest createPartRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -141,15 +141,12 @@ public okhttp3.Call createPartCall(CreatePartRequest createPartRequest, final Ap @SuppressWarnings("rawtypes") private okhttp3.Call createPartValidateBeforeCall(CreatePartRequest createPartRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createPartRequest' is set if (createPartRequest == null) { throw new ApiException("Missing the required parameter 'createPartRequest' when calling createPart(Async)"); } - - okhttp3.Call localVarCall = createPartCall(createPartRequest, _callback); - return localVarCall; + return createPartCall(createPartRequest, _callback); } @@ -160,7 +157,8 @@ private okhttp3.Call createPartValidateBeforeCall(CreatePartRequest createPartRe * @return Part * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
+
+ @@ -181,7 +179,8 @@ public Part createPart(CreatePartRequest createPartRequest) throws ApiException * @return ApiResponse<Part> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
+
+ @@ -204,7 +203,8 @@ public ApiResponse createPartWithHttpInfo(CreatePartRequest createPartRequ * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
+
+ @@ -227,7 +227,8 @@ public okhttp3.Call createPartAsync(CreatePartRequest createPartRequest, final A * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
+
+ @@ -237,7 +238,6 @@ public okhttp3.Call createPartAsync(CreatePartRequest createPartRequest, final A */ public okhttp3.Call deletePartCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -254,7 +254,7 @@ public okhttp3.Call deletePartCall(UUID id, final ApiCallback _callback) throws // create path and map variables String localVarPath = "/parts/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -271,7 +271,6 @@ public okhttp3.Call deletePartCall(UUID id, final ApiCallback _callback) throws } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -284,15 +283,12 @@ public okhttp3.Call deletePartCall(UUID id, final ApiCallback _callback) throws @SuppressWarnings("rawtypes") private okhttp3.Call deletePartValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deletePart(Async)"); } - - okhttp3.Call localVarCall = deletePartCall(id, _callback); - return localVarCall; + return deletePartCall(id, _callback); } @@ -303,7 +299,8 @@ private okhttp3.Call deletePartValidateBeforeCall(UUID id, final ApiCallback _ca * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -323,7 +320,8 @@ public QueuedJob deletePart(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -345,7 +343,8 @@ public ApiResponse deletePartWithHttpInfo(UUID id) throws ApiExceptio * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -368,7 +367,8 @@ public okhttp3.Call deletePartAsync(UUID id, final ApiCallback _callb * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
401 Unauthorized -
+
+ @@ -378,7 +378,6 @@ public okhttp3.Call deletePartAsync(UUID id, final ApiCallback _callb */ public okhttp3.Call getPartCall(UUID id, String include, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -395,7 +394,7 @@ public okhttp3.Call getPartCall(UUID id, String include, final ApiCallback _call // create path and map variables String localVarPath = "/parts/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -416,7 +415,6 @@ public okhttp3.Call getPartCall(UUID id, String include, final ApiCallback _call } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -429,15 +427,12 @@ public okhttp3.Call getPartCall(UUID id, String include, final ApiCallback _call @SuppressWarnings("rawtypes") private okhttp3.Call getPartValidateBeforeCall(UUID id, String include, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getPart(Async)"); } - - okhttp3.Call localVarCall = getPartCall(id, include, _callback); - return localVarCall; + return getPartCall(id, include, _callback); } @@ -449,7 +444,8 @@ private okhttp3.Call getPartValidateBeforeCall(UUID id, String include, final Ap * @return Part * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -470,7 +466,8 @@ public Part getPart(UUID id, String include) throws ApiException { * @return ApiResponse<Part> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -493,7 +490,8 @@ public ApiResponse getPartWithHttpInfo(UUID id, String include) throws Api * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -517,7 +515,8 @@ public okhttp3.Call getPartAsync(UUID id, String include, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -526,7 +525,6 @@ public okhttp3.Call getPartAsync(UUID id, String include, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -621,7 +616,8 @@ public PartList getParts(String pageCursor, Integer pageSize, String filterSuppl * @return ApiResponse<PartList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -644,7 +640,8 @@ public ApiResponse getPartsWithHttpInfo(String pageCursor, Integer pag * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -665,7 +662,8 @@ public okhttp3.Call getPartsAsync(String pageCursor, Integer pageSize, String fi * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -675,7 +673,6 @@ public okhttp3.Call getPartsAsync(String pageCursor, Integer pageSize, String fi */ public okhttp3.Call getQueuedPartDeletionCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -692,7 +689,7 @@ public okhttp3.Call getQueuedPartDeletionCall(UUID id, final ApiCallback _callba // create path and map variables String localVarPath = "/queued-part-deletions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -709,7 +706,6 @@ public okhttp3.Call getQueuedPartDeletionCall(UUID id, final ApiCallback _callba } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -722,15 +718,12 @@ public okhttp3.Call getQueuedPartDeletionCall(UUID id, final ApiCallback _callba @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedPartDeletionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedPartDeletion(Async)"); } - - okhttp3.Call localVarCall = getQueuedPartDeletionCall(id, _callback); - return localVarCall; + return getQueuedPartDeletionCall(id, _callback); } @@ -741,7 +734,8 @@ private okhttp3.Call getQueuedPartDeletionValidateBeforeCall(UUID id, final ApiC * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -761,7 +755,8 @@ public QueuedJob getQueuedPartDeletion(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -783,7 +778,8 @@ public ApiResponse getQueuedPartDeletionWithHttpInfo(UUID id) throws * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/PmiApi.java b/src/main/java/com/vertexvis/api/PmiApi.java new file mode 100644 index 0000000..68af7a4 --- /dev/null +++ b/src/main/java/com/vertexvis/api/PmiApi.java @@ -0,0 +1,230 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.api; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.ApiResponse; +import com.vertexvis.Configuration; +import com.vertexvis.Pair; +import com.vertexvis.ProgressRequestBody; +import com.vertexvis.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.vertexvis.model.Failure; +import com.vertexvis.model.PmiAnnotationList; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PmiApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PmiApi() { + this(Configuration.getDefaultApiClient()); + } + + public PmiApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPmiAnnotations + * @param filterModelViewId Filter annotations belonging to a model view. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPmiAnnotationsCall(UUID filterModelViewId, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pmi-annotations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filterModelViewId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[modelViewId]", filterModelViewId)); + } + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPmiAnnotationsValidateBeforeCall(UUID filterModelViewId, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + return getPmiAnnotationsCall(filterModelViewId, pageCursor, pageSize, _callback); + + } + + /** + * + * List `pmi-annotation`s. + * @param filterModelViewId Filter annotations belonging to a model view. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return PmiAnnotationList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public PmiAnnotationList getPmiAnnotations(UUID filterModelViewId, String pageCursor, Integer pageSize) throws ApiException { + ApiResponse localVarResp = getPmiAnnotationsWithHttpInfo(filterModelViewId, pageCursor, pageSize); + return localVarResp.getData(); + } + + /** + * + * List `pmi-annotation`s. + * @param filterModelViewId Filter annotations belonging to a model view. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @return ApiResponse<PmiAnnotationList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getPmiAnnotationsWithHttpInfo(UUID filterModelViewId, String pageCursor, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getPmiAnnotationsValidateBeforeCall(filterModelViewId, pageCursor, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List `pmi-annotation`s. + * @param filterModelViewId Filter annotations belonging to a model view. (optional) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPmiAnnotationsAsync(UUID filterModelViewId, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPmiAnnotationsValidateBeforeCall(filterModelViewId, pageCursor, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/vertexvis/api/PropertyEntriesApi.java b/src/main/java/com/vertexvis/api/PropertyEntriesApi.java new file mode 100644 index 0000000..44a9717 --- /dev/null +++ b/src/main/java/com/vertexvis/api/PropertyEntriesApi.java @@ -0,0 +1,370 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.api; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.ApiResponse; +import com.vertexvis.Configuration; +import com.vertexvis.Pair; +import com.vertexvis.ProgressRequestBody; +import com.vertexvis.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.vertexvis.model.Failure; +import com.vertexvis.model.PropertyEntryList; +import java.util.UUID; +import com.vertexvis.model.UpsertPropertyEntriesRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PropertyEntriesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PropertyEntriesApi() { + this(Configuration.getDefaultApiClient()); + } + + public PropertyEntriesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPropertyEntries + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterResourceId A resource ID to filter on (optional) + * @param filterResourceType The provided type for the resource ids (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPropertyEntriesCall(String pageCursor, Integer pageSize, UUID filterResourceId, String filterResourceType, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/property-entries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + if (filterResourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[resourceId]", filterResourceId)); + } + + if (filterResourceType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[resourceType]", filterResourceType)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPropertyEntriesValidateBeforeCall(String pageCursor, Integer pageSize, UUID filterResourceId, String filterResourceType, final ApiCallback _callback) throws ApiException { + return getPropertyEntriesCall(pageCursor, pageSize, filterResourceId, filterResourceType, _callback); + + } + + /** + * + * Get `property-entries` by a resource ID **Preview:** This is a preview API and is subject to change. + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterResourceId A resource ID to filter on (optional) + * @param filterResourceType The provided type for the resource ids (optional) + * @return PropertyEntryList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
+ */ + public PropertyEntryList getPropertyEntries(String pageCursor, Integer pageSize, UUID filterResourceId, String filterResourceType) throws ApiException { + ApiResponse localVarResp = getPropertyEntriesWithHttpInfo(pageCursor, pageSize, filterResourceId, filterResourceType); + return localVarResp.getData(); + } + + /** + * + * Get `property-entries` by a resource ID **Preview:** This is a preview API and is subject to change. + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterResourceId A resource ID to filter on (optional) + * @param filterResourceType The provided type for the resource ids (optional) + * @return ApiResponse<PropertyEntryList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
+ */ + public ApiResponse getPropertyEntriesWithHttpInfo(String pageCursor, Integer pageSize, UUID filterResourceId, String filterResourceType) throws ApiException { + okhttp3.Call localVarCall = getPropertyEntriesValidateBeforeCall(pageCursor, pageSize, filterResourceId, filterResourceType, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get `property-entries` by a resource ID **Preview:** This is a preview API and is subject to change. + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterResourceId A resource ID to filter on (optional) + * @param filterResourceType The provided type for the resource ids (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getPropertyEntriesAsync(String pageCursor, Integer pageSize, UUID filterResourceId, String filterResourceType, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPropertyEntriesValidateBeforeCall(pageCursor, pageSize, filterResourceId, filterResourceType, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for upsertPropertyEntries + * @param upsertPropertyEntriesRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call upsertPropertyEntriesCall(UpsertPropertyEntriesRequest upsertPropertyEntriesRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = upsertPropertyEntriesRequest; + + // create path and map variables + String localVarPath = "/property-entries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call upsertPropertyEntriesValidateBeforeCall(UpsertPropertyEntriesRequest upsertPropertyEntriesRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'upsertPropertyEntriesRequest' is set + if (upsertPropertyEntriesRequest == null) { + throw new ApiException("Missing the required parameter 'upsertPropertyEntriesRequest' when calling upsertPropertyEntries(Async)"); + } + + return upsertPropertyEntriesCall(upsertPropertyEntriesRequest, _callback); + + } + + /** + * + * Upsert property-entries for a provided resource. **Preview:** This is a preview API and is subject to change. + * @param upsertPropertyEntriesRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
404 Not Found -
+ */ + public void upsertPropertyEntries(UpsertPropertyEntriesRequest upsertPropertyEntriesRequest) throws ApiException { + upsertPropertyEntriesWithHttpInfo(upsertPropertyEntriesRequest); + } + + /** + * + * Upsert property-entries for a provided resource. **Preview:** This is a preview API and is subject to change. + * @param upsertPropertyEntriesRequest (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse upsertPropertyEntriesWithHttpInfo(UpsertPropertyEntriesRequest upsertPropertyEntriesRequest) throws ApiException { + okhttp3.Call localVarCall = upsertPropertyEntriesValidateBeforeCall(upsertPropertyEntriesRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Upsert property-entries for a provided resource. **Preview:** This is a preview API and is subject to change. + * @param upsertPropertyEntriesRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call upsertPropertyEntriesAsync(UpsertPropertyEntriesRequest upsertPropertyEntriesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = upsertPropertyEntriesValidateBeforeCall(upsertPropertyEntriesRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/vertexvis/api/SceneAlterationsApi.java b/src/main/java/com/vertexvis/api/SceneAlterationsApi.java index d53fd10..056bf3d 100644 --- a/src/main/java/com/vertexvis/api/SceneAlterationsApi.java +++ b/src/main/java/com/vertexvis/api/SceneAlterationsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -96,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneAlterationCall(UUID id, CreateSceneAlterationRequest createSceneAlterationRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -113,7 +113,7 @@ public okhttp3.Call createSceneAlterationCall(UUID id, CreateSceneAlterationRequ // create path and map variables String localVarPath = "/scene-views/{id}/scene-alterations" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -143,20 +143,17 @@ public okhttp3.Call createSceneAlterationCall(UUID id, CreateSceneAlterationRequ @SuppressWarnings("rawtypes") private okhttp3.Call createSceneAlterationValidateBeforeCall(UUID id, CreateSceneAlterationRequest createSceneAlterationRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneAlteration(Async)"); } - + // verify the required parameter 'createSceneAlterationRequest' is set if (createSceneAlterationRequest == null) { throw new ApiException("Missing the required parameter 'createSceneAlterationRequest' when calling createSceneAlteration(Async)"); } - - okhttp3.Call localVarCall = createSceneAlterationCall(id, createSceneAlterationRequest, _callback); - return localVarCall; + return createSceneAlterationCall(id, createSceneAlterationRequest, _callback); } @@ -168,7 +165,8 @@ private okhttp3.Call createSceneAlterationValidateBeforeCall(UUID id, CreateScen * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -190,7 +188,8 @@ public QueuedJob createSceneAlteration(UUID id, CreateSceneAlterationRequest cre * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -214,7 +213,8 @@ public ApiResponse createSceneAlterationWithHttpInfo(UUID id, CreateS * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -237,7 +237,8 @@ public okhttp3.Call createSceneAlterationAsync(UUID id, CreateSceneAlterationReq * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -248,7 +249,6 @@ public okhttp3.Call createSceneAlterationAsync(UUID id, CreateSceneAlterationReq */ public okhttp3.Call getQueuedSceneAlterationCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -265,7 +265,7 @@ public okhttp3.Call getQueuedSceneAlterationCall(UUID id, final ApiCallback _cal // create path and map variables String localVarPath = "/queued-scene-alterations/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -282,7 +282,6 @@ public okhttp3.Call getQueuedSceneAlterationCall(UUID id, final ApiCallback _cal } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -295,15 +294,12 @@ public okhttp3.Call getQueuedSceneAlterationCall(UUID id, final ApiCallback _cal @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedSceneAlterationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedSceneAlteration(Async)"); } - - okhttp3.Call localVarCall = getQueuedSceneAlterationCall(id, _callback); - return localVarCall; + return getQueuedSceneAlterationCall(id, _callback); } @@ -314,7 +310,8 @@ private okhttp3.Call getQueuedSceneAlterationValidateBeforeCall(UUID id, final A * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -335,7 +332,8 @@ public QueuedJob getQueuedSceneAlteration(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -358,7 +356,8 @@ public ApiResponse getQueuedSceneAlterationWithHttpInfo(UUID id) thro * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -381,7 +380,8 @@ public okhttp3.Call getQueuedSceneAlterationAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+ @@ -391,7 +391,6 @@ public okhttp3.Call getQueuedSceneAlterationAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -425,7 +424,6 @@ public okhttp3.Call getSceneAlterationCall(UUID id, final ApiCallback _callback) } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -438,15 +436,12 @@ public okhttp3.Call getSceneAlterationCall(UUID id, final ApiCallback _callback) @SuppressWarnings("rawtypes") private okhttp3.Call getSceneAlterationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneAlteration(Async)"); } - - okhttp3.Call localVarCall = getSceneAlterationCall(id, _callback); - return localVarCall; + return getSceneAlterationCall(id, _callback); } @@ -457,7 +452,8 @@ private okhttp3.Call getSceneAlterationValidateBeforeCall(UUID id, final ApiCall * @return SceneAlteration * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -477,7 +473,8 @@ public SceneAlteration getSceneAlteration(UUID id) throws ApiException { * @return ApiResponse<SceneAlteration> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -499,7 +496,8 @@ public ApiResponse getSceneAlterationWithHttpInfo(UUID id) thro * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -521,7 +519,8 @@ public okhttp3.Call getSceneAlterationAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -531,7 +530,6 @@ public okhttp3.Call getSceneAlterationAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -565,7 +563,6 @@ public okhttp3.Call getSceneAlterationsCall(UUID id, final ApiCallback _callback } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -578,15 +575,12 @@ public okhttp3.Call getSceneAlterationsCall(UUID id, final ApiCallback _callback @SuppressWarnings("rawtypes") private okhttp3.Call getSceneAlterationsValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneAlterations(Async)"); } - - okhttp3.Call localVarCall = getSceneAlterationsCall(id, _callback); - return localVarCall; + return getSceneAlterationsCall(id, _callback); } @@ -597,7 +591,8 @@ private okhttp3.Call getSceneAlterationsValidateBeforeCall(UUID id, final ApiCal * @return SceneAlterationList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -617,7 +612,8 @@ public SceneAlterationList getSceneAlterations(UUID id) throws ApiException { * @return ApiResponse<SceneAlterationList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -639,7 +635,8 @@ public ApiResponse getSceneAlterationsWithHttpInfo(UUID id) * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/SceneAnnotationsApi.java b/src/main/java/com/vertexvis/api/SceneAnnotationsApi.java new file mode 100644 index 0000000..0d22d52 --- /dev/null +++ b/src/main/java/com/vertexvis/api/SceneAnnotationsApi.java @@ -0,0 +1,811 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.api; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.ApiResponse; +import com.vertexvis.Configuration; +import com.vertexvis.Pair; +import com.vertexvis.ProgressRequestBody; +import com.vertexvis.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.vertexvis.model.CreateSceneAnnotationRequest; +import com.vertexvis.model.CreateSceneAnnotationSetRequest; +import com.vertexvis.model.Failure; +import com.vertexvis.model.SceneAnnotation; +import com.vertexvis.model.SceneAnnotationSet; +import com.vertexvis.model.SceneAnnotationSetList; +import java.util.UUID; +import com.vertexvis.model.UpdateSceneAnnotationRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SceneAnnotationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SceneAnnotationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public SceneAnnotationsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createSceneAnnotation + * @param id The `scene-annotation-set` ID. (required) + * @param createSceneAnnotationRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public okhttp3.Call createSceneAnnotationCall(UUID id, CreateSceneAnnotationRequest createSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createSceneAnnotationRequest; + + // create path and map variables + String localVarPath = "/scene-annotation-sets/{id}/scene-annotations" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createSceneAnnotationValidateBeforeCall(UUID id, CreateSceneAnnotationRequest createSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling createSceneAnnotation(Async)"); + } + + // verify the required parameter 'createSceneAnnotationRequest' is set + if (createSceneAnnotationRequest == null) { + throw new ApiException("Missing the required parameter 'createSceneAnnotationRequest' when calling createSceneAnnotation(Async)"); + } + + return createSceneAnnotationCall(id, createSceneAnnotationRequest, _callback); + + } + + /** + * + * Create an annotation belonging to an annotation set. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation-set` ID. (required) + * @param createSceneAnnotationRequest (required) + * @return SceneAnnotation + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public SceneAnnotation createSceneAnnotation(UUID id, CreateSceneAnnotationRequest createSceneAnnotationRequest) throws ApiException { + ApiResponse localVarResp = createSceneAnnotationWithHttpInfo(id, createSceneAnnotationRequest); + return localVarResp.getData(); + } + + /** + * + * Create an annotation belonging to an annotation set. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation-set` ID. (required) + * @param createSceneAnnotationRequest (required) + * @return ApiResponse<SceneAnnotation> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public ApiResponse createSceneAnnotationWithHttpInfo(UUID id, CreateSceneAnnotationRequest createSceneAnnotationRequest) throws ApiException { + okhttp3.Call localVarCall = createSceneAnnotationValidateBeforeCall(id, createSceneAnnotationRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create an annotation belonging to an annotation set. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation-set` ID. (required) + * @param createSceneAnnotationRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public okhttp3.Call createSceneAnnotationAsync(UUID id, CreateSceneAnnotationRequest createSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createSceneAnnotationValidateBeforeCall(id, createSceneAnnotationRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createSceneAnnotationSet + * @param id The `scene` ID. (required) + * @param createSceneAnnotationSetRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public okhttp3.Call createSceneAnnotationSetCall(UUID id, CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createSceneAnnotationSetRequest; + + // create path and map variables + String localVarPath = "/scenes/{id}/scene-annotation-sets" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createSceneAnnotationSetValidateBeforeCall(UUID id, CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling createSceneAnnotationSet(Async)"); + } + + // verify the required parameter 'createSceneAnnotationSetRequest' is set + if (createSceneAnnotationSetRequest == null) { + throw new ApiException("Missing the required parameter 'createSceneAnnotationSetRequest' when calling createSceneAnnotationSet(Async)"); + } + + return createSceneAnnotationSetCall(id, createSceneAnnotationSetRequest, _callback); + + } + + /** + * + * Create an annotation set that is associated with a scene. **Preview:** This is a preview API and is subject to change. + * @param id The `scene` ID. (required) + * @param createSceneAnnotationSetRequest (required) + * @return SceneAnnotationSet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public SceneAnnotationSet createSceneAnnotationSet(UUID id, CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest) throws ApiException { + ApiResponse localVarResp = createSceneAnnotationSetWithHttpInfo(id, createSceneAnnotationSetRequest); + return localVarResp.getData(); + } + + /** + * + * Create an annotation set that is associated with a scene. **Preview:** This is a preview API and is subject to change. + * @param id The `scene` ID. (required) + * @param createSceneAnnotationSetRequest (required) + * @return ApiResponse<SceneAnnotationSet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public ApiResponse createSceneAnnotationSetWithHttpInfo(UUID id, CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest) throws ApiException { + okhttp3.Call localVarCall = createSceneAnnotationSetValidateBeforeCall(id, createSceneAnnotationSetRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create an annotation set that is associated with a scene. **Preview:** This is a preview API and is subject to change. + * @param id The `scene` ID. (required) + * @param createSceneAnnotationSetRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Created * location -
404 Not Found -
+ */ + public okhttp3.Call createSceneAnnotationSetAsync(UUID id, CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createSceneAnnotationSetValidateBeforeCall(id, createSceneAnnotationSetRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteSceneAnnotation + * @param id The `scene-annotation` ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call deleteSceneAnnotationCall(UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/scene-annotations/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSceneAnnotationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteSceneAnnotation(Async)"); + } + + return deleteSceneAnnotationCall(id, _callback); + + } + + /** + * + * Delete a scene annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public void deleteSceneAnnotation(UUID id) throws ApiException { + deleteSceneAnnotationWithHttpInfo(id); + } + + /** + * + * Delete a scene annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse deleteSceneAnnotationWithHttpInfo(UUID id) throws ApiException { + okhttp3.Call localVarCall = deleteSceneAnnotationValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete a scene annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call deleteSceneAnnotationAsync(UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteSceneAnnotationValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getSceneAnnotationSets + * @param id The `scene` ID. (required) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterId Comma-separated list of IDs to filter on. (optional) + * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getSceneAnnotationSetsCall(UUID id, String pageCursor, Integer pageSize, String filterId, String filterSuppliedId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/scenes/{id}/scene-annotation-sets" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pageCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[cursor]", pageCursor)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); + } + + if (filterId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[id]", filterId)); + } + + if (filterSuppliedId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[suppliedId]", filterSuppliedId)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSceneAnnotationSetsValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, String filterId, String filterSuppliedId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getSceneAnnotationSets(Async)"); + } + + return getSceneAnnotationSetsCall(id, pageCursor, pageSize, filterId, filterSuppliedId, _callback); + + } + + /** + * + * Get `scene-annotation-sets` for a `scene`. + * @param id The `scene` ID. (required) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterId Comma-separated list of IDs to filter on. (optional) + * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) + * @return SceneAnnotationSetList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public SceneAnnotationSetList getSceneAnnotationSets(UUID id, String pageCursor, Integer pageSize, String filterId, String filterSuppliedId) throws ApiException { + ApiResponse localVarResp = getSceneAnnotationSetsWithHttpInfo(id, pageCursor, pageSize, filterId, filterSuppliedId); + return localVarResp.getData(); + } + + /** + * + * Get `scene-annotation-sets` for a `scene`. + * @param id The `scene` ID. (required) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterId Comma-separated list of IDs to filter on. (optional) + * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) + * @return ApiResponse<SceneAnnotationSetList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public ApiResponse getSceneAnnotationSetsWithHttpInfo(UUID id, String pageCursor, Integer pageSize, String filterId, String filterSuppliedId) throws ApiException { + okhttp3.Call localVarCall = getSceneAnnotationSetsValidateBeforeCall(id, pageCursor, pageSize, filterId, filterSuppliedId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get `scene-annotation-sets` for a `scene`. + * @param id The `scene` ID. (required) + * @param pageCursor The cursor for the next page of items. (optional) + * @param pageSize The number of items to return. (optional) + * @param filterId Comma-separated list of IDs to filter on. (optional) + * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
415 Unsupported Media Type -
+ */ + public okhttp3.Call getSceneAnnotationSetsAsync(UUID id, String pageCursor, Integer pageSize, String filterId, String filterSuppliedId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSceneAnnotationSetsValidateBeforeCall(id, pageCursor, pageSize, filterId, filterSuppliedId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateSceneAnnotation + * @param id The `scene-annotation` ID. (required) + * @param updateSceneAnnotationRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
404 Not Found -
+ */ + public okhttp3.Call updateSceneAnnotationCall(UUID id, UpdateSceneAnnotationRequest updateSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateSceneAnnotationRequest; + + // create path and map variables + String localVarPath = "/scene-annotations/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSceneAnnotationValidateBeforeCall(UUID id, UpdateSceneAnnotationRequest updateSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateSceneAnnotation(Async)"); + } + + // verify the required parameter 'updateSceneAnnotationRequest' is set + if (updateSceneAnnotationRequest == null) { + throw new ApiException("Missing the required parameter 'updateSceneAnnotationRequest' when calling updateSceneAnnotation(Async)"); + } + + return updateSceneAnnotationCall(id, updateSceneAnnotationRequest, _callback); + + } + + /** + * + * Update the attributes of an annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @param updateSceneAnnotationRequest (required) + * @return SceneAnnotation + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
404 Not Found -
+ */ + public SceneAnnotation updateSceneAnnotation(UUID id, UpdateSceneAnnotationRequest updateSceneAnnotationRequest) throws ApiException { + ApiResponse localVarResp = updateSceneAnnotationWithHttpInfo(id, updateSceneAnnotationRequest); + return localVarResp.getData(); + } + + /** + * + * Update the attributes of an annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @param updateSceneAnnotationRequest (required) + * @return ApiResponse<SceneAnnotation> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
404 Not Found -
+ */ + public ApiResponse updateSceneAnnotationWithHttpInfo(UUID id, UpdateSceneAnnotationRequest updateSceneAnnotationRequest) throws ApiException { + okhttp3.Call localVarCall = updateSceneAnnotationValidateBeforeCall(id, updateSceneAnnotationRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Update the attributes of an annotation. **Preview:** This is a preview API and is subject to change. + * @param id The `scene-annotation` ID. (required) + * @param updateSceneAnnotationRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
404 Not Found -
+ */ + public okhttp3.Call updateSceneAnnotationAsync(UUID id, UpdateSceneAnnotationRequest updateSceneAnnotationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSceneAnnotationValidateBeforeCall(id, updateSceneAnnotationRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/vertexvis/api/SceneItemOverridesApi.java b/src/main/java/com/vertexvis/api/SceneItemOverridesApi.java index 4d8a75c..dafc3d1 100644 --- a/src/main/java/com/vertexvis/api/SceneItemOverridesApi.java +++ b/src/main/java/com/vertexvis/api/SceneItemOverridesApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -96,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneItemOverrideCall(UUID id, CreateSceneItemOverrideRequest createSceneItemOverrideRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -113,7 +113,7 @@ public okhttp3.Call createSceneItemOverrideCall(UUID id, CreateSceneItemOverride // create path and map variables String localVarPath = "/scene-views/{id}/scene-item-overrides" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -143,20 +143,17 @@ public okhttp3.Call createSceneItemOverrideCall(UUID id, CreateSceneItemOverride @SuppressWarnings("rawtypes") private okhttp3.Call createSceneItemOverrideValidateBeforeCall(UUID id, CreateSceneItemOverrideRequest createSceneItemOverrideRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneItemOverride(Async)"); } - + // verify the required parameter 'createSceneItemOverrideRequest' is set if (createSceneItemOverrideRequest == null) { throw new ApiException("Missing the required parameter 'createSceneItemOverrideRequest' when calling createSceneItemOverride(Async)"); } - - okhttp3.Call localVarCall = createSceneItemOverrideCall(id, createSceneItemOverrideRequest, _callback); - return localVarCall; + return createSceneItemOverrideCall(id, createSceneItemOverrideRequest, _callback); } @@ -168,7 +165,8 @@ private okhttp3.Call createSceneItemOverrideValidateBeforeCall(UUID id, CreateSc * @return SceneItemOverride * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -190,7 +188,8 @@ public SceneItemOverride createSceneItemOverride(UUID id, CreateSceneItemOverrid * @return ApiResponse<SceneItemOverride> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -214,7 +213,8 @@ public ApiResponse createSceneItemOverrideWithHttpInfo(UUID i * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -237,7 +237,8 @@ public okhttp3.Call createSceneItemOverrideAsync(UUID id, CreateSceneItemOverrid * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -247,7 +248,6 @@ public okhttp3.Call createSceneItemOverrideAsync(UUID id, CreateSceneItemOverrid */ public okhttp3.Call deleteSceneItemOverrideCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -264,7 +264,7 @@ public okhttp3.Call deleteSceneItemOverrideCall(UUID id, final ApiCallback _call // create path and map variables String localVarPath = "/scene-item-overrides/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -281,7 +281,6 @@ public okhttp3.Call deleteSceneItemOverrideCall(UUID id, final ApiCallback _call } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -294,15 +293,12 @@ public okhttp3.Call deleteSceneItemOverrideCall(UUID id, final ApiCallback _call @SuppressWarnings("rawtypes") private okhttp3.Call deleteSceneItemOverrideValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteSceneItemOverride(Async)"); } - - okhttp3.Call localVarCall = deleteSceneItemOverrideCall(id, _callback); - return localVarCall; + return deleteSceneItemOverrideCall(id, _callback); } @@ -312,7 +308,8 @@ private okhttp3.Call deleteSceneItemOverrideValidateBeforeCall(UUID id, final Ap * @param id The `scene-item-override` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -331,7 +328,8 @@ public void deleteSceneItemOverride(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -352,7 +350,8 @@ public ApiResponse deleteSceneItemOverrideWithHttpInfo(UUID id) throws Api * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -375,7 +374,8 @@ public okhttp3.Call deleteSceneItemOverrideAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+ @@ -385,7 +385,6 @@ public okhttp3.Call deleteSceneItemOverrideAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -427,7 +426,6 @@ public okhttp3.Call getSceneItemOverridesCall(UUID id, String pageCursor, Intege } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -440,15 +438,12 @@ public okhttp3.Call getSceneItemOverridesCall(UUID id, String pageCursor, Intege @SuppressWarnings("rawtypes") private okhttp3.Call getSceneItemOverridesValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneItemOverrides(Async)"); } - - okhttp3.Call localVarCall = getSceneItemOverridesCall(id, pageCursor, pageSize, _callback); - return localVarCall; + return getSceneItemOverridesCall(id, pageCursor, pageSize, _callback); } @@ -461,7 +456,8 @@ private okhttp3.Call getSceneItemOverridesValidateBeforeCall(UUID id, String pag * @return SceneItemOverrideList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -483,7 +479,8 @@ public SceneItemOverrideList getSceneItemOverrides(UUID id, String pageCursor, I * @return ApiResponse<SceneItemOverrideList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -507,7 +504,8 @@ public ApiResponse getSceneItemOverridesWithHttpInfo(UUID * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -530,7 +528,8 @@ public okhttp3.Call getSceneItemOverridesAsync(UUID id, String pageCursor, Integ * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -541,7 +540,6 @@ public okhttp3.Call getSceneItemOverridesAsync(UUID id, String pageCursor, Integ */ public okhttp3.Call updateSceneItemOverrideCall(UUID id, UpdateSceneItemOverrideRequest updateSceneItemOverrideRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -558,7 +556,7 @@ public okhttp3.Call updateSceneItemOverrideCall(UUID id, UpdateSceneItemOverride // create path and map variables String localVarPath = "/scene-item-overrides/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -588,20 +586,17 @@ public okhttp3.Call updateSceneItemOverrideCall(UUID id, UpdateSceneItemOverride @SuppressWarnings("rawtypes") private okhttp3.Call updateSceneItemOverrideValidateBeforeCall(UUID id, UpdateSceneItemOverrideRequest updateSceneItemOverrideRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateSceneItemOverride(Async)"); } - + // verify the required parameter 'updateSceneItemOverrideRequest' is set if (updateSceneItemOverrideRequest == null) { throw new ApiException("Missing the required parameter 'updateSceneItemOverrideRequest' when calling updateSceneItemOverride(Async)"); } - - okhttp3.Call localVarCall = updateSceneItemOverrideCall(id, updateSceneItemOverrideRequest, _callback); - return localVarCall; + return updateSceneItemOverrideCall(id, updateSceneItemOverrideRequest, _callback); } @@ -613,7 +608,8 @@ private okhttp3.Call updateSceneItemOverrideValidateBeforeCall(UUID id, UpdateSc * @return SceneItemOverride * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -635,7 +631,8 @@ public SceneItemOverride updateSceneItemOverride(UUID id, UpdateSceneItemOverrid * @return ApiResponse<SceneItemOverride> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -659,7 +656,8 @@ public ApiResponse updateSceneItemOverrideWithHttpInfo(UUID i * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/SceneItemsApi.java b/src/main/java/com/vertexvis/api/SceneItemsApi.java index 4e38d60..b937996 100644 --- a/src/main/java/com/vertexvis/api/SceneItemsApi.java +++ b/src/main/java/com/vertexvis/api/SceneItemsApi.java @@ -86,7 +86,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -98,7 +99,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneItemCall(UUID id, CreateSceneItemRequest createSceneItemRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -115,7 +115,7 @@ public okhttp3.Call createSceneItemCall(UUID id, CreateSceneItemRequest createSc // create path and map variables String localVarPath = "/scenes/{id}/scene-items" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -145,20 +145,17 @@ public okhttp3.Call createSceneItemCall(UUID id, CreateSceneItemRequest createSc @SuppressWarnings("rawtypes") private okhttp3.Call createSceneItemValidateBeforeCall(UUID id, CreateSceneItemRequest createSceneItemRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneItem(Async)"); } - + // verify the required parameter 'createSceneItemRequest' is set if (createSceneItemRequest == null) { throw new ApiException("Missing the required parameter 'createSceneItemRequest' when calling createSceneItem(Async)"); } - - okhttp3.Call localVarCall = createSceneItemCall(id, createSceneItemRequest, _callback); - return localVarCall; + return createSceneItemCall(id, createSceneItemRequest, _callback); } @@ -170,7 +167,8 @@ private okhttp3.Call createSceneItemValidateBeforeCall(UUID id, CreateSceneItemR * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -193,7 +191,8 @@ public QueuedJob createSceneItem(UUID id, CreateSceneItemRequest createSceneItem * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -218,7 +217,8 @@ public ApiResponse createSceneItemWithHttpInfo(UUID id, CreateSceneIt * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -242,7 +242,8 @@ public okhttp3.Call createSceneItemAsync(UUID id, CreateSceneItemRequest createS * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -252,7 +253,6 @@ public okhttp3.Call createSceneItemAsync(UUID id, CreateSceneItemRequest createS */ public okhttp3.Call deleteSceneItemCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -269,7 +269,7 @@ public okhttp3.Call deleteSceneItemCall(UUID id, final ApiCallback _callback) th // create path and map variables String localVarPath = "/scene-items/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -286,7 +286,6 @@ public okhttp3.Call deleteSceneItemCall(UUID id, final ApiCallback _callback) th } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -299,15 +298,12 @@ public okhttp3.Call deleteSceneItemCall(UUID id, final ApiCallback _callback) th @SuppressWarnings("rawtypes") private okhttp3.Call deleteSceneItemValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteSceneItem(Async)"); } - - okhttp3.Call localVarCall = deleteSceneItemCall(id, _callback); - return localVarCall; + return deleteSceneItemCall(id, _callback); } @@ -317,7 +313,8 @@ private okhttp3.Call deleteSceneItemValidateBeforeCall(UUID id, final ApiCallbac * @param id The `scene-item` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -336,7 +333,8 @@ public void deleteSceneItem(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -357,7 +355,8 @@ public ApiResponse deleteSceneItemWithHttpInfo(UUID id) throws ApiExceptio * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -378,7 +377,8 @@ public okhttp3.Call deleteSceneItemAsync(UUID id, final ApiCallback _callb * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -389,7 +389,6 @@ public okhttp3.Call deleteSceneItemAsync(UUID id, final ApiCallback _callb */ public okhttp3.Call getQueuedSceneItemCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -406,7 +405,7 @@ public okhttp3.Call getQueuedSceneItemCall(UUID id, final ApiCallback _callback) // create path and map variables String localVarPath = "/queued-scene-items/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -423,7 +422,6 @@ public okhttp3.Call getQueuedSceneItemCall(UUID id, final ApiCallback _callback) } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -436,15 +434,12 @@ public okhttp3.Call getQueuedSceneItemCall(UUID id, final ApiCallback _callback) @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedSceneItemValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedSceneItem(Async)"); } - - okhttp3.Call localVarCall = getQueuedSceneItemCall(id, _callback); - return localVarCall; + return getQueuedSceneItemCall(id, _callback); } @@ -455,7 +450,8 @@ private okhttp3.Call getQueuedSceneItemValidateBeforeCall(UUID id, final ApiCall * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -476,7 +472,8 @@ public QueuedJob getQueuedSceneItem(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -499,7 +496,8 @@ public ApiResponse getQueuedSceneItemWithHttpInfo(UUID id) throws Api * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -522,7 +520,8 @@ public okhttp3.Call getQueuedSceneItemAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+ @@ -532,7 +531,6 @@ public okhttp3.Call getQueuedSceneItemAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -566,7 +564,6 @@ public okhttp3.Call getQueuedSceneItemDeletionCall(UUID id, final ApiCallback _c } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -579,15 +576,12 @@ public okhttp3.Call getQueuedSceneItemDeletionCall(UUID id, final ApiCallback _c @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedSceneItemDeletionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedSceneItemDeletion(Async)"); } - - okhttp3.Call localVarCall = getQueuedSceneItemDeletionCall(id, _callback); - return localVarCall; + return getQueuedSceneItemDeletionCall(id, _callback); } @@ -598,7 +592,8 @@ private okhttp3.Call getQueuedSceneItemDeletionValidateBeforeCall(UUID id, final * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -618,7 +613,8 @@ public QueuedJob getQueuedSceneItemDeletion(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -640,7 +636,8 @@ public ApiResponse getQueuedSceneItemDeletionWithHttpInfo(UUID id) th * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -663,7 +660,8 @@ public okhttp3.Call getQueuedSceneItemDeletionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -673,7 +671,6 @@ public okhttp3.Call getQueuedSceneItemDeletionAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -711,7 +708,6 @@ public okhttp3.Call getSceneItemCall(UUID id, String fieldsSceneItem, final ApiC } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -724,15 +720,12 @@ public okhttp3.Call getSceneItemCall(UUID id, String fieldsSceneItem, final ApiC @SuppressWarnings("rawtypes") private okhttp3.Call getSceneItemValidateBeforeCall(UUID id, String fieldsSceneItem, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneItem(Async)"); } - - okhttp3.Call localVarCall = getSceneItemCall(id, fieldsSceneItem, _callback); - return localVarCall; + return getSceneItemCall(id, fieldsSceneItem, _callback); } @@ -744,7 +737,8 @@ private okhttp3.Call getSceneItemValidateBeforeCall(UUID id, String fieldsSceneI * @return SceneItem * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -765,7 +759,8 @@ public SceneItem getSceneItem(UUID id, String fieldsSceneItem) throws ApiExcepti * @return ApiResponse<SceneItem> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -788,7 +783,8 @@ public ApiResponse getSceneItemWithHttpInfo(UUID id, String fieldsSce * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -815,7 +811,8 @@ public okhttp3.Call getSceneItemAsync(UUID id, String fieldsSceneItem, final Api * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -825,7 +822,6 @@ public okhttp3.Call getSceneItemAsync(UUID id, String fieldsSceneItem, final Api */ public okhttp3.Call getSceneItemsCall(UUID id, String pageCursor, Integer pageSize, String filterSource, String filterSuppliedId, UUID filterParent, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -842,7 +838,7 @@ public okhttp3.Call getSceneItemsCall(UUID id, String pageCursor, Integer pageSi // create path and map variables String localVarPath = "/scenes/{id}/scene-items" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -879,7 +875,6 @@ public okhttp3.Call getSceneItemsCall(UUID id, String pageCursor, Integer pageSi } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -892,15 +887,12 @@ public okhttp3.Call getSceneItemsCall(UUID id, String pageCursor, Integer pageSi @SuppressWarnings("rawtypes") private okhttp3.Call getSceneItemsValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, String filterSource, String filterSuppliedId, UUID filterParent, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneItems(Async)"); } - - okhttp3.Call localVarCall = getSceneItemsCall(id, pageCursor, pageSize, filterSource, filterSuppliedId, filterParent, _callback); - return localVarCall; + return getSceneItemsCall(id, pageCursor, pageSize, filterSource, filterSuppliedId, filterParent, _callback); } @@ -916,7 +908,8 @@ private okhttp3.Call getSceneItemsValidateBeforeCall(UUID id, String pageCursor, * @return SceneItemList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -941,7 +934,8 @@ public SceneItemList getSceneItems(UUID id, String pageCursor, Integer pageSize, * @return ApiResponse<SceneItemList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -968,7 +962,8 @@ public ApiResponse getSceneItemsWithHttpInfo(UUID id, String page * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -991,7 +986,8 @@ public okhttp3.Call getSceneItemsAsync(UUID id, String pageCursor, Integer pageS * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -1002,7 +998,6 @@ public okhttp3.Call getSceneItemsAsync(UUID id, String pageCursor, Integer pageS */ public okhttp3.Call updateSceneItemCall(UUID id, UpdateSceneItemRequest updateSceneItemRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -1019,7 +1014,7 @@ public okhttp3.Call updateSceneItemCall(UUID id, UpdateSceneItemRequest updateSc // create path and map variables String localVarPath = "/scene-items/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1049,20 +1044,17 @@ public okhttp3.Call updateSceneItemCall(UUID id, UpdateSceneItemRequest updateSc @SuppressWarnings("rawtypes") private okhttp3.Call updateSceneItemValidateBeforeCall(UUID id, UpdateSceneItemRequest updateSceneItemRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateSceneItem(Async)"); } - + // verify the required parameter 'updateSceneItemRequest' is set if (updateSceneItemRequest == null) { throw new ApiException("Missing the required parameter 'updateSceneItemRequest' when calling updateSceneItem(Async)"); } - - okhttp3.Call localVarCall = updateSceneItemCall(id, updateSceneItemRequest, _callback); - return localVarCall; + return updateSceneItemCall(id, updateSceneItemRequest, _callback); } @@ -1074,7 +1066,8 @@ private okhttp3.Call updateSceneItemValidateBeforeCall(UUID id, UpdateSceneItemR * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -1096,7 +1089,8 @@ public QueuedJob updateSceneItem(UUID id, UpdateSceneItemRequest updateSceneItem * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -1120,7 +1114,8 @@ public ApiResponse updateSceneItemWithHttpInfo(UUID id, UpdateSceneIt * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/SceneSynchronizationsApi.java b/src/main/java/com/vertexvis/api/SceneSynchronizationsApi.java index 8bfb20e..506d8b6 100644 --- a/src/main/java/com/vertexvis/api/SceneSynchronizationsApi.java +++ b/src/main/java/com/vertexvis/api/SceneSynchronizationsApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
400 Bad Request -
+
+ @@ -93,7 +94,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneSyncCall(UUID id, CreateSceneSyncRequest createSceneSyncRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -110,7 +110,7 @@ public okhttp3.Call createSceneSyncCall(UUID id, CreateSceneSyncRequest createSc // create path and map variables String localVarPath = "/scenes/{id}/scene-syncs" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -140,20 +140,17 @@ public okhttp3.Call createSceneSyncCall(UUID id, CreateSceneSyncRequest createSc @SuppressWarnings("rawtypes") private okhttp3.Call createSceneSyncValidateBeforeCall(UUID id, CreateSceneSyncRequest createSceneSyncRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneSync(Async)"); } - + // verify the required parameter 'createSceneSyncRequest' is set if (createSceneSyncRequest == null) { throw new ApiException("Missing the required parameter 'createSceneSyncRequest' when calling createSceneSync(Async)"); } - - okhttp3.Call localVarCall = createSceneSyncCall(id, createSceneSyncRequest, _callback); - return localVarCall; + return createSceneSyncCall(id, createSceneSyncRequest, _callback); } @@ -165,7 +162,8 @@ private okhttp3.Call createSceneSyncValidateBeforeCall(UUID id, CreateSceneSyncR * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
404 Not Found -
+
+ @@ -184,7 +182,8 @@ public QueuedJob createSceneSync(UUID id, CreateSceneSyncRequest createSceneSync * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
404 Not Found -
+
+ @@ -205,7 +204,8 @@ public ApiResponse createSceneSyncWithHttpInfo(UUID id, CreateSceneSy * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
404 Not Found -
+
+ @@ -225,7 +225,8 @@ public okhttp3.Call createSceneSyncAsync(UUID id, CreateSceneSyncRequest createS * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
202 Accepted * content-location -
404 Not Found -
+
+ @@ -235,7 +236,6 @@ public okhttp3.Call createSceneSyncAsync(UUID id, CreateSceneSyncRequest createS */ public okhttp3.Call getQueuedSceneSyncCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -252,7 +252,7 @@ public okhttp3.Call getQueuedSceneSyncCall(UUID id, final ApiCallback _callback) // create path and map variables String localVarPath = "/queued-scene-syncs/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -269,7 +269,6 @@ public okhttp3.Call getQueuedSceneSyncCall(UUID id, final ApiCallback _callback) } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -282,15 +281,12 @@ public okhttp3.Call getQueuedSceneSyncCall(UUID id, final ApiCallback _callback) @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedSceneSyncValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedSceneSync(Async)"); } - - okhttp3.Call localVarCall = getQueuedSceneSyncCall(id, _callback); - return localVarCall; + return getQueuedSceneSyncCall(id, _callback); } @@ -301,7 +297,8 @@ private okhttp3.Call getQueuedSceneSyncValidateBeforeCall(UUID id, final ApiCall * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -321,7 +318,8 @@ public QueuedJob getQueuedSceneSync(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -343,7 +341,8 @@ public ApiResponse getQueuedSceneSyncWithHttpInfo(UUID id) throws Api * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -365,7 +364,8 @@ public okhttp3.Call getQueuedSceneSyncAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -375,7 +375,6 @@ public okhttp3.Call getQueuedSceneSyncAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -409,7 +408,6 @@ public okhttp3.Call getSceneSyncCall(UUID id, final ApiCallback _callback) throw } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -422,15 +420,12 @@ public okhttp3.Call getSceneSyncCall(UUID id, final ApiCallback _callback) throw @SuppressWarnings("rawtypes") private okhttp3.Call getSceneSyncValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneSync(Async)"); } - - okhttp3.Call localVarCall = getSceneSyncCall(id, _callback); - return localVarCall; + return getSceneSyncCall(id, _callback); } @@ -441,7 +436,8 @@ private okhttp3.Call getSceneSyncValidateBeforeCall(UUID id, final ApiCallback _ * @return SceneSync * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -461,7 +457,8 @@ public SceneSync getSceneSync(UUID id) throws ApiException { * @return ApiResponse<SceneSync> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -483,7 +480,8 @@ public ApiResponse getSceneSyncWithHttpInfo(UUID id) throws ApiExcept * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -508,7 +506,8 @@ public okhttp3.Call getSceneSyncAsync(UUID id, final ApiCallback _cal * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -518,7 +517,6 @@ public okhttp3.Call getSceneSyncAsync(UUID id, final ApiCallback _cal */ public okhttp3.Call getSceneSyncItemResultsCall(UUID id, String pageCursor, Integer pageSize, UUID filterSceneItemId, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -535,7 +533,7 @@ public okhttp3.Call getSceneSyncItemResultsCall(UUID id, String pageCursor, Inte // create path and map variables String localVarPath = "/scene-syncs/{id}/item-results" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -564,7 +562,6 @@ public okhttp3.Call getSceneSyncItemResultsCall(UUID id, String pageCursor, Inte } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -577,15 +574,12 @@ public okhttp3.Call getSceneSyncItemResultsCall(UUID id, String pageCursor, Inte @SuppressWarnings("rawtypes") private okhttp3.Call getSceneSyncItemResultsValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, UUID filterSceneItemId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneSyncItemResults(Async)"); } - - okhttp3.Call localVarCall = getSceneSyncItemResultsCall(id, pageCursor, pageSize, filterSceneItemId, _callback); - return localVarCall; + return getSceneSyncItemResultsCall(id, pageCursor, pageSize, filterSceneItemId, _callback); } @@ -599,7 +593,8 @@ private okhttp3.Call getSceneSyncItemResultsValidateBeforeCall(UUID id, String p * @return SceneSyncItemResultsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -622,7 +617,8 @@ public SceneSyncItemResultsList getSceneSyncItemResults(UUID id, String pageCurs * @return ApiResponse<SceneSyncItemResultsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -647,7 +643,8 @@ public ApiResponse getSceneSyncItemResultsWithHttpInfo * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/SceneViewStatesApi.java b/src/main/java/com/vertexvis/api/SceneViewStatesApi.java index eb3e3f3..fe42543 100644 --- a/src/main/java/com/vertexvis/api/SceneViewStatesApi.java +++ b/src/main/java/com/vertexvis/api/SceneViewStatesApi.java @@ -85,7 +85,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -96,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneViewStateCall(UUID id, CreateSceneViewStateRequest createSceneViewStateRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -113,7 +113,7 @@ public okhttp3.Call createSceneViewStateCall(UUID id, CreateSceneViewStateReques // create path and map variables String localVarPath = "/scenes/{id}/scene-view-states" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -143,20 +143,17 @@ public okhttp3.Call createSceneViewStateCall(UUID id, CreateSceneViewStateReques @SuppressWarnings("rawtypes") private okhttp3.Call createSceneViewStateValidateBeforeCall(UUID id, CreateSceneViewStateRequest createSceneViewStateRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneViewState(Async)"); } - + // verify the required parameter 'createSceneViewStateRequest' is set if (createSceneViewStateRequest == null) { throw new ApiException("Missing the required parameter 'createSceneViewStateRequest' when calling createSceneViewState(Async)"); } - - okhttp3.Call localVarCall = createSceneViewStateCall(id, createSceneViewStateRequest, _callback); - return localVarCall; + return createSceneViewStateCall(id, createSceneViewStateRequest, _callback); } @@ -168,7 +165,8 @@ private okhttp3.Call createSceneViewStateValidateBeforeCall(UUID id, CreateScene * @return SceneViewState * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -190,7 +188,8 @@ public SceneViewState createSceneViewState(UUID id, CreateSceneViewStateRequest * @return ApiResponse<SceneViewState> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -214,7 +213,8 @@ public ApiResponse createSceneViewStateWithHttpInfo(UUID id, Cre * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -237,7 +237,8 @@ public okhttp3.Call createSceneViewStateAsync(UUID id, CreateSceneViewStateReque * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -247,7 +248,6 @@ public okhttp3.Call createSceneViewStateAsync(UUID id, CreateSceneViewStateReque */ public okhttp3.Call deleteSceneViewStateCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -264,7 +264,7 @@ public okhttp3.Call deleteSceneViewStateCall(UUID id, final ApiCallback _callbac // create path and map variables String localVarPath = "/scene-view-states/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -281,7 +281,6 @@ public okhttp3.Call deleteSceneViewStateCall(UUID id, final ApiCallback _callbac } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -294,15 +293,12 @@ public okhttp3.Call deleteSceneViewStateCall(UUID id, final ApiCallback _callbac @SuppressWarnings("rawtypes") private okhttp3.Call deleteSceneViewStateValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteSceneViewState(Async)"); } - - okhttp3.Call localVarCall = deleteSceneViewStateCall(id, _callback); - return localVarCall; + return deleteSceneViewStateCall(id, _callback); } @@ -312,7 +308,8 @@ private okhttp3.Call deleteSceneViewStateValidateBeforeCall(UUID id, final ApiCa * @param id The `scene-view-state` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -331,7 +328,8 @@ public void deleteSceneViewState(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -352,7 +350,8 @@ public ApiResponse deleteSceneViewStateWithHttpInfo(UUID id) throws ApiExc * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -374,7 +373,8 @@ public okhttp3.Call deleteSceneViewStateAsync(UUID id, final ApiCallback _ * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -384,7 +384,6 @@ public okhttp3.Call deleteSceneViewStateAsync(UUID id, final ApiCallback _ */ public okhttp3.Call getSceneViewStateCall(UUID id, String fieldsSceneViewState, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -401,7 +400,7 @@ public okhttp3.Call getSceneViewStateCall(UUID id, String fieldsSceneViewState, // create path and map variables String localVarPath = "/scene-view-states/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -422,7 +421,6 @@ public okhttp3.Call getSceneViewStateCall(UUID id, String fieldsSceneViewState, } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -435,15 +433,12 @@ public okhttp3.Call getSceneViewStateCall(UUID id, String fieldsSceneViewState, @SuppressWarnings("rawtypes") private okhttp3.Call getSceneViewStateValidateBeforeCall(UUID id, String fieldsSceneViewState, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneViewState(Async)"); } - - okhttp3.Call localVarCall = getSceneViewStateCall(id, fieldsSceneViewState, _callback); - return localVarCall; + return getSceneViewStateCall(id, fieldsSceneViewState, _callback); } @@ -455,7 +450,8 @@ private okhttp3.Call getSceneViewStateValidateBeforeCall(UUID id, String fieldsS * @return SceneViewState * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -476,7 +472,8 @@ public SceneViewState getSceneViewState(UUID id, String fieldsSceneViewState) th * @return ApiResponse<SceneViewState> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -499,7 +496,8 @@ public ApiResponse getSceneViewStateWithHttpInfo(UUID id, String * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -526,7 +524,8 @@ public okhttp3.Call getSceneViewStateAsync(UUID id, String fieldsSceneViewState, * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -535,7 +534,6 @@ public okhttp3.Call getSceneViewStateAsync(UUID id, String fieldsSceneViewState, */ public okhttp3.Call getSceneViewStatesCall(UUID id, String pageCursor, Integer pageSize, String fieldsSceneViewState, String filterId, String filterSuppliedId, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -552,7 +550,7 @@ public okhttp3.Call getSceneViewStatesCall(UUID id, String pageCursor, Integer p // create path and map variables String localVarPath = "/scenes/{id}/scene-view-states" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -589,7 +587,6 @@ public okhttp3.Call getSceneViewStatesCall(UUID id, String pageCursor, Integer p } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -602,15 +599,12 @@ public okhttp3.Call getSceneViewStatesCall(UUID id, String pageCursor, Integer p @SuppressWarnings("rawtypes") private okhttp3.Call getSceneViewStatesValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, String fieldsSceneViewState, String filterId, String filterSuppliedId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneViewStates(Async)"); } - - okhttp3.Call localVarCall = getSceneViewStatesCall(id, pageCursor, pageSize, fieldsSceneViewState, filterId, filterSuppliedId, _callback); - return localVarCall; + return getSceneViewStatesCall(id, pageCursor, pageSize, fieldsSceneViewState, filterId, filterSuppliedId, _callback); } @@ -626,7 +620,8 @@ private okhttp3.Call getSceneViewStatesValidateBeforeCall(UUID id, String pageCu * @return SceneViewStateList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -650,7 +645,8 @@ public SceneViewStateList getSceneViewStates(UUID id, String pageCursor, Integer * @return ApiResponse<SceneViewStateList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -676,7 +672,8 @@ public ApiResponse getSceneViewStatesWithHttpInfo(UUID id, S * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -698,7 +695,8 @@ public okhttp3.Call getSceneViewStatesAsync(UUID id, String pageCursor, Integer * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -709,7 +707,6 @@ public okhttp3.Call getSceneViewStatesAsync(UUID id, String pageCursor, Integer */ public okhttp3.Call updateSceneViewStateCall(UUID id, UpdateSceneViewStateRequest updateSceneViewStateRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -726,7 +723,7 @@ public okhttp3.Call updateSceneViewStateCall(UUID id, UpdateSceneViewStateReques // create path and map variables String localVarPath = "/scene-view-states/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -756,20 +753,17 @@ public okhttp3.Call updateSceneViewStateCall(UUID id, UpdateSceneViewStateReques @SuppressWarnings("rawtypes") private okhttp3.Call updateSceneViewStateValidateBeforeCall(UUID id, UpdateSceneViewStateRequest updateSceneViewStateRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateSceneViewState(Async)"); } - + // verify the required parameter 'updateSceneViewStateRequest' is set if (updateSceneViewStateRequest == null) { throw new ApiException("Missing the required parameter 'updateSceneViewStateRequest' when calling updateSceneViewState(Async)"); } - - okhttp3.Call localVarCall = updateSceneViewStateCall(id, updateSceneViewStateRequest, _callback); - return localVarCall; + return updateSceneViewStateCall(id, updateSceneViewStateRequest, _callback); } @@ -781,7 +775,8 @@ private okhttp3.Call updateSceneViewStateValidateBeforeCall(UUID id, UpdateScene * @return SceneViewState * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -803,7 +798,8 @@ public SceneViewState updateSceneViewState(UUID id, UpdateSceneViewStateRequest * @return ApiResponse<SceneViewState> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -827,7 +823,8 @@ public ApiResponse updateSceneViewStateWithHttpInfo(UUID id, Upd * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/SceneViewsApi.java b/src/main/java/com/vertexvis/api/SceneViewsApi.java index 5aadf65..e0b48fb 100644 --- a/src/main/java/com/vertexvis/api/SceneViewsApi.java +++ b/src/main/java/com/vertexvis/api/SceneViewsApi.java @@ -87,7 +87,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -98,7 +99,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneViewCall(UUID id, CreateSceneViewRequest createSceneViewRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -115,7 +115,7 @@ public okhttp3.Call createSceneViewCall(UUID id, CreateSceneViewRequest createSc // create path and map variables String localVarPath = "/scenes/{id}/scene-views" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -145,20 +145,17 @@ public okhttp3.Call createSceneViewCall(UUID id, CreateSceneViewRequest createSc @SuppressWarnings("rawtypes") private okhttp3.Call createSceneViewValidateBeforeCall(UUID id, CreateSceneViewRequest createSceneViewRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneView(Async)"); } - + // verify the required parameter 'createSceneViewRequest' is set if (createSceneViewRequest == null) { throw new ApiException("Missing the required parameter 'createSceneViewRequest' when calling createSceneView(Async)"); } - - okhttp3.Call localVarCall = createSceneViewCall(id, createSceneViewRequest, _callback); - return localVarCall; + return createSceneViewCall(id, createSceneViewRequest, _callback); } @@ -170,7 +167,8 @@ private okhttp3.Call createSceneViewValidateBeforeCall(UUID id, CreateSceneViewR * @return SceneView * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -192,7 +190,8 @@ public SceneView createSceneView(UUID id, CreateSceneViewRequest createSceneView * @return ApiResponse<SceneView> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -216,7 +215,8 @@ public ApiResponse createSceneViewWithHttpInfo(UUID id, CreateSceneVi * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -239,7 +239,8 @@ public okhttp3.Call createSceneViewAsync(UUID id, CreateSceneViewRequest createS * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -249,7 +250,6 @@ public okhttp3.Call createSceneViewAsync(UUID id, CreateSceneViewRequest createS */ public okhttp3.Call deleteSceneViewCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -266,7 +266,7 @@ public okhttp3.Call deleteSceneViewCall(UUID id, final ApiCallback _callback) th // create path and map variables String localVarPath = "/scene-views/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -283,7 +283,6 @@ public okhttp3.Call deleteSceneViewCall(UUID id, final ApiCallback _callback) th } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -296,15 +295,12 @@ public okhttp3.Call deleteSceneViewCall(UUID id, final ApiCallback _callback) th @SuppressWarnings("rawtypes") private okhttp3.Call deleteSceneViewValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteSceneView(Async)"); } - - okhttp3.Call localVarCall = deleteSceneViewCall(id, _callback); - return localVarCall; + return deleteSceneViewCall(id, _callback); } @@ -314,7 +310,8 @@ private okhttp3.Call deleteSceneViewValidateBeforeCall(UUID id, final ApiCallbac * @param id The `scene-view` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -333,7 +330,8 @@ public void deleteSceneView(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -354,7 +352,8 @@ public ApiResponse deleteSceneViewWithHttpInfo(UUID id) throws ApiExceptio * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -375,7 +374,8 @@ public okhttp3.Call deleteSceneViewAsync(UUID id, final ApiCallback _callb * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -385,7 +385,6 @@ public okhttp3.Call deleteSceneViewAsync(UUID id, final ApiCallback _callb */ public okhttp3.Call getSceneViewCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -402,7 +401,7 @@ public okhttp3.Call getSceneViewCall(UUID id, final ApiCallback _callback) throw // create path and map variables String localVarPath = "/scene-views/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -419,7 +418,6 @@ public okhttp3.Call getSceneViewCall(UUID id, final ApiCallback _callback) throw } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -432,15 +430,12 @@ public okhttp3.Call getSceneViewCall(UUID id, final ApiCallback _callback) throw @SuppressWarnings("rawtypes") private okhttp3.Call getSceneViewValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneView(Async)"); } - - okhttp3.Call localVarCall = getSceneViewCall(id, _callback); - return localVarCall; + return getSceneViewCall(id, _callback); } @@ -451,7 +446,8 @@ private okhttp3.Call getSceneViewValidateBeforeCall(UUID id, final ApiCallback _ * @return SceneView * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -471,7 +467,8 @@ public SceneView getSceneView(UUID id) throws ApiException { * @return ApiResponse<SceneView> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -493,7 +490,8 @@ public ApiResponse getSceneViewWithHttpInfo(UUID id) throws ApiExcept * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -517,7 +515,8 @@ public okhttp3.Call getSceneViewAsync(UUID id, final ApiCallback _cal * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -526,7 +525,6 @@ public okhttp3.Call getSceneViewAsync(UUID id, final ApiCallback _cal */ public okhttp3.Call getSceneViewsCall(UUID id, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -543,7 +541,7 @@ public okhttp3.Call getSceneViewsCall(UUID id, String pageCursor, Integer pageSi // create path and map variables String localVarPath = "/scenes/{id}/scene-views" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -568,7 +566,6 @@ public okhttp3.Call getSceneViewsCall(UUID id, String pageCursor, Integer pageSi } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -581,15 +578,12 @@ public okhttp3.Call getSceneViewsCall(UUID id, String pageCursor, Integer pageSi @SuppressWarnings("rawtypes") private okhttp3.Call getSceneViewsValidateBeforeCall(UUID id, String pageCursor, Integer pageSize, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getSceneViews(Async)"); } - - okhttp3.Call localVarCall = getSceneViewsCall(id, pageCursor, pageSize, _callback); - return localVarCall; + return getSceneViewsCall(id, pageCursor, pageSize, _callback); } @@ -602,7 +596,8 @@ private okhttp3.Call getSceneViewsValidateBeforeCall(UUID id, String pageCursor, * @return SceneViewList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -623,7 +618,8 @@ public SceneViewList getSceneViews(UUID id, String pageCursor, Integer pageSize) * @return ApiResponse<SceneViewList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -646,7 +642,8 @@ public ApiResponse getSceneViewsWithHttpInfo(UUID id, String page * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -670,7 +667,8 @@ public okhttp3.Call getSceneViewsAsync(UUID id, String pageCursor, Integer pageS * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -680,7 +678,6 @@ public okhttp3.Call getSceneViewsAsync(UUID id, String pageCursor, Integer pageS */ public okhttp3.Call getViewSceneItemCall(UUID id, UUID itemId, String fieldsSceneItem, String include, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -697,8 +694,8 @@ public okhttp3.Call getViewSceneItemCall(UUID id, UUID itemId, String fieldsScen // create path and map variables String localVarPath = "/scene-views/{id}/scene-items/{itemId}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())) - .replaceAll("\\{" + "itemId" + "\\}", localVarApiClient.escapeString(itemId.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())) + .replace("{" + "itemId" + "}", localVarApiClient.escapeString(itemId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -723,7 +720,6 @@ public okhttp3.Call getViewSceneItemCall(UUID id, UUID itemId, String fieldsScen } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -736,20 +732,17 @@ public okhttp3.Call getViewSceneItemCall(UUID id, UUID itemId, String fieldsScen @SuppressWarnings("rawtypes") private okhttp3.Call getViewSceneItemValidateBeforeCall(UUID id, UUID itemId, String fieldsSceneItem, String include, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getViewSceneItem(Async)"); } - + // verify the required parameter 'itemId' is set if (itemId == null) { throw new ApiException("Missing the required parameter 'itemId' when calling getViewSceneItem(Async)"); } - - okhttp3.Call localVarCall = getViewSceneItemCall(id, itemId, fieldsSceneItem, include, _callback); - return localVarCall; + return getViewSceneItemCall(id, itemId, fieldsSceneItem, include, _callback); } @@ -763,7 +756,8 @@ private okhttp3.Call getViewSceneItemValidateBeforeCall(UUID id, UUID itemId, St * @return SceneViewItem * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -786,7 +780,8 @@ public SceneViewItem getViewSceneItem(UUID id, UUID itemId, String fieldsSceneIt * @return ApiResponse<SceneViewItem> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -811,7 +806,8 @@ public ApiResponse getViewSceneItemWithHttpInfo(UUID id, UUID ite * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -835,7 +831,8 @@ public okhttp3.Call getViewSceneItemAsync(UUID id, UUID itemId, String fieldsSce * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -846,7 +843,6 @@ public okhttp3.Call getViewSceneItemAsync(UUID id, UUID itemId, String fieldsSce */ public okhttp3.Call renderSceneViewCall(UUID id, Integer height, Integer width, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -863,7 +859,7 @@ public okhttp3.Call renderSceneViewCall(UUID id, Integer height, Integer width, // create path and map variables String localVarPath = "/scene-views/{id}/image" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -880,7 +876,9 @@ public okhttp3.Call renderSceneViewCall(UUID id, Integer height, Integer width, } final String[] localVarAccepts = { - "image/jpeg", "image/png", "application/vnd.api+json" + "image/jpeg", + "image/png", + "application/vnd.api+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -888,7 +886,6 @@ public okhttp3.Call renderSceneViewCall(UUID id, Integer height, Integer width, } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -901,15 +898,12 @@ public okhttp3.Call renderSceneViewCall(UUID id, Integer height, Integer width, @SuppressWarnings("rawtypes") private okhttp3.Call renderSceneViewValidateBeforeCall(UUID id, Integer height, Integer width, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling renderSceneView(Async)"); } - - okhttp3.Call localVarCall = renderSceneViewCall(id, height, width, _callback); - return localVarCall; + return renderSceneViewCall(id, height, width, _callback); } @@ -922,7 +916,8 @@ private okhttp3.Call renderSceneViewValidateBeforeCall(UUID id, Integer height, * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -945,7 +940,8 @@ public File renderSceneView(UUID id, Integer height, Integer width) throws ApiEx * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -970,7 +966,8 @@ public ApiResponse renderSceneViewWithHttpInfo(UUID id, Integer height, In * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -994,7 +991,8 @@ public okhttp3.Call renderSceneViewAsync(UUID id, Integer height, Integer width, * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -1005,7 +1003,6 @@ public okhttp3.Call renderSceneViewAsync(UUID id, Integer height, Integer width, */ public okhttp3.Call updateSceneViewCall(UUID id, UpdateSceneViewRequest updateSceneViewRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -1022,7 +1019,7 @@ public okhttp3.Call updateSceneViewCall(UUID id, UpdateSceneViewRequest updateSc // create path and map variables String localVarPath = "/scene-views/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1052,20 +1049,17 @@ public okhttp3.Call updateSceneViewCall(UUID id, UpdateSceneViewRequest updateSc @SuppressWarnings("rawtypes") private okhttp3.Call updateSceneViewValidateBeforeCall(UUID id, UpdateSceneViewRequest updateSceneViewRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateSceneView(Async)"); } - + // verify the required parameter 'updateSceneViewRequest' is set if (updateSceneViewRequest == null) { throw new ApiException("Missing the required parameter 'updateSceneViewRequest' when calling updateSceneView(Async)"); } - - okhttp3.Call localVarCall = updateSceneViewCall(id, updateSceneViewRequest, _callback); - return localVarCall; + return updateSceneViewCall(id, updateSceneViewRequest, _callback); } @@ -1077,7 +1071,8 @@ private okhttp3.Call updateSceneViewValidateBeforeCall(UUID id, UpdateSceneViewR * @return SceneView * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -1099,7 +1094,8 @@ public SceneView updateSceneView(UUID id, UpdateSceneViewRequest updateSceneView * @return ApiResponse<SceneView> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -1123,7 +1119,8 @@ public ApiResponse updateSceneViewWithHttpInfo(UUID id, UpdateSceneVi * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/ScenesApi.java b/src/main/java/com/vertexvis/api/ScenesApi.java index 6206373..3e2c694 100644 --- a/src/main/java/com/vertexvis/api/ScenesApi.java +++ b/src/main/java/com/vertexvis/api/ScenesApi.java @@ -86,7 +86,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -96,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneCall(CreateSceneRequest createSceneRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -142,15 +142,12 @@ public okhttp3.Call createSceneCall(CreateSceneRequest createSceneRequest, final @SuppressWarnings("rawtypes") private okhttp3.Call createSceneValidateBeforeCall(CreateSceneRequest createSceneRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createSceneRequest' is set if (createSceneRequest == null) { throw new ApiException("Missing the required parameter 'createSceneRequest' when calling createScene(Async)"); } - - okhttp3.Call localVarCall = createSceneCall(createSceneRequest, _callback); - return localVarCall; + return createSceneCall(createSceneRequest, _callback); } @@ -161,7 +158,8 @@ private okhttp3.Call createSceneValidateBeforeCall(CreateSceneRequest createScen * @return Scene * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -181,7 +179,8 @@ public Scene createScene(CreateSceneRequest createSceneRequest) throws ApiExcept * @return ApiResponse<Scene> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -203,7 +202,8 @@ public ApiResponse createSceneWithHttpInfo(CreateSceneRequest createScene * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -225,7 +225,8 @@ public okhttp3.Call createSceneAsync(CreateSceneRequest createSceneRequest, fina * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -235,7 +236,6 @@ public okhttp3.Call createSceneAsync(CreateSceneRequest createSceneRequest, fina */ public okhttp3.Call deleteSceneCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -252,7 +252,7 @@ public okhttp3.Call deleteSceneCall(UUID id, final ApiCallback _callback) throws // create path and map variables String localVarPath = "/scenes/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -269,7 +269,6 @@ public okhttp3.Call deleteSceneCall(UUID id, final ApiCallback _callback) throws } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -282,15 +281,12 @@ public okhttp3.Call deleteSceneCall(UUID id, final ApiCallback _callback) throws @SuppressWarnings("rawtypes") private okhttp3.Call deleteSceneValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteScene(Async)"); } - - okhttp3.Call localVarCall = deleteSceneCall(id, _callback); - return localVarCall; + return deleteSceneCall(id, _callback); } @@ -300,7 +296,8 @@ private okhttp3.Call deleteSceneValidateBeforeCall(UUID id, final ApiCallback _c * @param id The `scene` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -319,7 +316,8 @@ public void deleteScene(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -340,7 +338,8 @@ public ApiResponse deleteSceneWithHttpInfo(UUID id) throws ApiException { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -361,7 +360,8 @@ public okhttp3.Call deleteSceneAsync(UUID id, final ApiCallback _callback) * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -372,7 +372,6 @@ public okhttp3.Call deleteSceneAsync(UUID id, final ApiCallback _callback) */ public okhttp3.Call getQueuedSceneCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -389,7 +388,7 @@ public okhttp3.Call getQueuedSceneCall(UUID id, final ApiCallback _callback) thr // create path and map variables String localVarPath = "/queued-scenes/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -406,7 +405,6 @@ public okhttp3.Call getQueuedSceneCall(UUID id, final ApiCallback _callback) thr } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -419,15 +417,12 @@ public okhttp3.Call getQueuedSceneCall(UUID id, final ApiCallback _callback) thr @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedSceneValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedScene(Async)"); } - - okhttp3.Call localVarCall = getQueuedSceneCall(id, _callback); - return localVarCall; + return getQueuedSceneCall(id, _callback); } @@ -438,7 +433,8 @@ private okhttp3.Call getQueuedSceneValidateBeforeCall(UUID id, final ApiCallback * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -459,7 +455,8 @@ public QueuedJob getQueuedScene(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -482,7 +479,8 @@ public ApiResponse getQueuedSceneWithHttpInfo(UUID id) throws ApiExce * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -506,7 +504,8 @@ public okhttp3.Call getQueuedSceneAsync(UUID id, final ApiCallback _c * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -516,7 +515,6 @@ public okhttp3.Call getQueuedSceneAsync(UUID id, final ApiCallback _c */ public okhttp3.Call getSceneCall(UUID id, String fieldsScene, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -533,7 +531,7 @@ public okhttp3.Call getSceneCall(UUID id, String fieldsScene, final ApiCallback // create path and map variables String localVarPath = "/scenes/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -554,7 +552,6 @@ public okhttp3.Call getSceneCall(UUID id, String fieldsScene, final ApiCallback } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -567,15 +564,12 @@ public okhttp3.Call getSceneCall(UUID id, String fieldsScene, final ApiCallback @SuppressWarnings("rawtypes") private okhttp3.Call getSceneValidateBeforeCall(UUID id, String fieldsScene, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getScene(Async)"); } - - okhttp3.Call localVarCall = getSceneCall(id, fieldsScene, _callback); - return localVarCall; + return getSceneCall(id, fieldsScene, _callback); } @@ -587,7 +581,8 @@ private okhttp3.Call getSceneValidateBeforeCall(UUID id, String fieldsScene, fin * @return Scene * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -608,7 +603,8 @@ public Scene getScene(UUID id, String fieldsScene) throws ApiException { * @return ApiResponse<Scene> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -631,7 +627,8 @@ public ApiResponse getSceneWithHttpInfo(UUID id, String fieldsScene) thro * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -654,20 +651,23 @@ public okhttp3.Call getSceneAsync(UUID id, String fieldsScene, final ApiCallback * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) * @param fieldsScene Comma-separated list of fields to return in response. An empty value returns no fields. `metadata` is only returned if explicitly requested. (optional) * @param filterMetadata Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. (optional) + * @param filterSceneItemsSourcePartRevision Comma-separated list of scene-item source part revision IDs to filter on. (optional) + * @param filterSceneItemsSourceGeometrySet Comma-separated list of scene-item source geometry set IDs to filter on. (optional) + * @param filterSceneItemsSourceScene Comma-separated list of scene-item source scene IDs to filter on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public okhttp3.Call getScenesCall(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getScenesCall(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, String filterSceneItemsSourcePartRevision, String filterSceneItemsSourceGeometrySet, String filterSceneItemsSourceScene, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -715,6 +715,18 @@ public okhttp3.Call getScenesCall(String pageCursor, Integer pageSize, String fi localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[metadata]", filterMetadata)); } + if (filterSceneItemsSourcePartRevision != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[sceneItems.source.partRevision]", filterSceneItemsSourcePartRevision)); + } + + if (filterSceneItemsSourceGeometrySet != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[sceneItems.source.geometrySet]", filterSceneItemsSourceGeometrySet)); + } + + if (filterSceneItemsSourceScene != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[sceneItems.source.scene]", filterSceneItemsSourceScene)); + } + final String[] localVarAccepts = { "application/vnd.api+json" }; @@ -724,7 +736,6 @@ public okhttp3.Call getScenesCall(String pageCursor, Integer pageSize, String fi } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -736,11 +747,8 @@ public okhttp3.Call getScenesCall(String pageCursor, Integer pageSize, String fi } @SuppressWarnings("rawtypes") - private okhttp3.Call getScenesValidateBeforeCall(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getScenesCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, _callback); - return localVarCall; + private okhttp3.Call getScenesValidateBeforeCall(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, String filterSceneItemsSourcePartRevision, String filterSceneItemsSourceGeometrySet, String filterSceneItemsSourceScene, final ApiCallback _callback) throws ApiException { + return getScenesCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, filterSceneItemsSourcePartRevision, filterSceneItemsSourceGeometrySet, filterSceneItemsSourceScene, _callback); } @@ -753,18 +761,22 @@ private okhttp3.Call getScenesValidateBeforeCall(String pageCursor, Integer page * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) * @param fieldsScene Comma-separated list of fields to return in response. An empty value returns no fields. `metadata` is only returned if explicitly requested. (optional) * @param filterMetadata Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. (optional) + * @param filterSceneItemsSourcePartRevision Comma-separated list of scene-item source part revision IDs to filter on. (optional) + * @param filterSceneItemsSourceGeometrySet Comma-separated list of scene-item source geometry set IDs to filter on. (optional) + * @param filterSceneItemsSourceScene Comma-separated list of scene-item source scene IDs to filter on. (optional) * @return SceneList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public SceneList getScenes(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata) throws ApiException { - ApiResponse localVarResp = getScenesWithHttpInfo(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata); + public SceneList getScenes(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, String filterSceneItemsSourcePartRevision, String filterSceneItemsSourceGeometrySet, String filterSceneItemsSourceScene) throws ApiException { + ApiResponse localVarResp = getScenesWithHttpInfo(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, filterSceneItemsSourcePartRevision, filterSceneItemsSourceGeometrySet, filterSceneItemsSourceScene); return localVarResp.getData(); } @@ -777,18 +789,22 @@ public SceneList getScenes(String pageCursor, Integer pageSize, String filterNam * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) * @param fieldsScene Comma-separated list of fields to return in response. An empty value returns no fields. `metadata` is only returned if explicitly requested. (optional) * @param filterMetadata Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. (optional) + * @param filterSceneItemsSourcePartRevision Comma-separated list of scene-item source part revision IDs to filter on. (optional) + * @param filterSceneItemsSourceGeometrySet Comma-separated list of scene-item source geometry set IDs to filter on. (optional) + * @param filterSceneItemsSourceScene Comma-separated list of scene-item source scene IDs to filter on. (optional) * @return ApiResponse<SceneList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public ApiResponse getScenesWithHttpInfo(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata) throws ApiException { - okhttp3.Call localVarCall = getScenesValidateBeforeCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, null); + public ApiResponse getScenesWithHttpInfo(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, String filterSceneItemsSourcePartRevision, String filterSceneItemsSourceGeometrySet, String filterSceneItemsSourceScene) throws ApiException { + okhttp3.Call localVarCall = getScenesValidateBeforeCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, filterSceneItemsSourcePartRevision, filterSceneItemsSourceGeometrySet, filterSceneItemsSourceScene, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -802,20 +818,24 @@ public ApiResponse getScenesWithHttpInfo(String pageCursor, Integer p * @param filterSuppliedId Comma-separated list of supplied IDs to filter on. (optional) * @param fieldsScene Comma-separated list of fields to return in response. An empty value returns no fields. `metadata` is only returned if explicitly requested. (optional) * @param filterMetadata Filter scenes that contain all the given metadata key-value pairs. Should be specified in query parameter map notation: `filter[metadata][key1]=value1&filter[metadata][key]=value2`. (optional) + * @param filterSceneItemsSourcePartRevision Comma-separated list of scene-item source part revision IDs to filter on. (optional) + * @param filterSceneItemsSourceGeometrySet Comma-separated list of scene-item source geometry set IDs to filter on. (optional) + * @param filterSceneItemsSourceScene Comma-separated list of scene-item source scene IDs to filter on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public okhttp3.Call getScenesAsync(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getScenesAsync(String pageCursor, Integer pageSize, String filterName, String filterSuppliedId, String fieldsScene, Map filterMetadata, String filterSceneItemsSourcePartRevision, String filterSceneItemsSourceGeometrySet, String filterSceneItemsSourceScene, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getScenesValidateBeforeCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, _callback); + okhttp3.Call localVarCall = getScenesValidateBeforeCall(pageCursor, pageSize, filterName, filterSuppliedId, fieldsScene, filterMetadata, filterSceneItemsSourcePartRevision, filterSceneItemsSourceGeometrySet, filterSceneItemsSourceScene, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; @@ -829,7 +849,8 @@ public okhttp3.Call getScenesAsync(String pageCursor, Integer pageSize, String f * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -840,7 +861,6 @@ public okhttp3.Call getScenesAsync(String pageCursor, Integer pageSize, String f */ public okhttp3.Call renderSceneCall(UUID id, Integer height, Integer width, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -857,7 +877,7 @@ public okhttp3.Call renderSceneCall(UUID id, Integer height, Integer width, fina // create path and map variables String localVarPath = "/scenes/{id}/image" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -874,7 +894,9 @@ public okhttp3.Call renderSceneCall(UUID id, Integer height, Integer width, fina } final String[] localVarAccepts = { - "image/jpeg", "image/png", "application/vnd.api+json" + "image/jpeg", + "image/png", + "application/vnd.api+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -882,7 +904,6 @@ public okhttp3.Call renderSceneCall(UUID id, Integer height, Integer width, fina } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -895,15 +916,12 @@ public okhttp3.Call renderSceneCall(UUID id, Integer height, Integer width, fina @SuppressWarnings("rawtypes") private okhttp3.Call renderSceneValidateBeforeCall(UUID id, Integer height, Integer width, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling renderScene(Async)"); } - - okhttp3.Call localVarCall = renderSceneCall(id, height, width, _callback); - return localVarCall; + return renderSceneCall(id, height, width, _callback); } @@ -916,7 +934,8 @@ private okhttp3.Call renderSceneValidateBeforeCall(UUID id, Integer height, Inte * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -939,7 +958,8 @@ public File renderScene(UUID id, Integer height, Integer width) throws ApiExcept * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -964,7 +984,8 @@ public ApiResponse renderSceneWithHttpInfo(UUID id, Integer height, Intege * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -988,7 +1009,8 @@ public okhttp3.Call renderSceneAsync(UUID id, Integer height, Integer width, fin * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -999,7 +1021,6 @@ public okhttp3.Call renderSceneAsync(UUID id, Integer height, Integer width, fin */ public okhttp3.Call updateSceneCall(UUID id, UpdateSceneRequest updateSceneRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -1016,7 +1037,7 @@ public okhttp3.Call updateSceneCall(UUID id, UpdateSceneRequest updateSceneReque // create path and map variables String localVarPath = "/scenes/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1046,20 +1067,17 @@ public okhttp3.Call updateSceneCall(UUID id, UpdateSceneRequest updateSceneReque @SuppressWarnings("rawtypes") private okhttp3.Call updateSceneValidateBeforeCall(UUID id, UpdateSceneRequest updateSceneRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateScene(Async)"); } - + // verify the required parameter 'updateSceneRequest' is set if (updateSceneRequest == null) { throw new ApiException("Missing the required parameter 'updateSceneRequest' when calling updateScene(Async)"); } - - okhttp3.Call localVarCall = updateSceneCall(id, updateSceneRequest, _callback); - return localVarCall; + return updateSceneCall(id, updateSceneRequest, _callback); } @@ -1071,7 +1089,8 @@ private okhttp3.Call updateSceneValidateBeforeCall(UUID id, UpdateSceneRequest u * @return Scene * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -1093,7 +1112,8 @@ public Scene updateScene(UUID id, UpdateSceneRequest updateSceneRequest) throws * @return ApiResponse<Scene> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -1117,7 +1137,8 @@ public ApiResponse updateSceneWithHttpInfo(UUID id, UpdateSceneRequest up * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/api/StreamKeysApi.java b/src/main/java/com/vertexvis/api/StreamKeysApi.java index 0725d14..874d9d9 100644 --- a/src/main/java/com/vertexvis/api/StreamKeysApi.java +++ b/src/main/java/com/vertexvis/api/StreamKeysApi.java @@ -84,7 +84,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -94,7 +95,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createSceneStreamKeyCall(UUID id, CreateStreamKeyRequest createStreamKeyRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -111,7 +111,7 @@ public okhttp3.Call createSceneStreamKeyCall(UUID id, CreateStreamKeyRequest cre // create path and map variables String localVarPath = "/scenes/{id}/stream-keys" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -141,20 +141,17 @@ public okhttp3.Call createSceneStreamKeyCall(UUID id, CreateStreamKeyRequest cre @SuppressWarnings("rawtypes") private okhttp3.Call createSceneStreamKeyValidateBeforeCall(UUID id, CreateStreamKeyRequest createStreamKeyRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling createSceneStreamKey(Async)"); } - + // verify the required parameter 'createStreamKeyRequest' is set if (createStreamKeyRequest == null) { throw new ApiException("Missing the required parameter 'createStreamKeyRequest' when calling createSceneStreamKey(Async)"); } - - okhttp3.Call localVarCall = createSceneStreamKeyCall(id, createStreamKeyRequest, _callback); - return localVarCall; + return createSceneStreamKeyCall(id, createStreamKeyRequest, _callback); } @@ -166,7 +163,8 @@ private okhttp3.Call createSceneStreamKeyValidateBeforeCall(UUID id, CreateStrea * @return StreamKey * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -187,7 +185,8 @@ public StreamKey createSceneStreamKey(UUID id, CreateStreamKeyRequest createStre * @return ApiResponse<StreamKey> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -210,7 +209,8 @@ public ApiResponse createSceneStreamKeyWithHttpInfo(UUID id, CreateSt * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -232,7 +232,8 @@ public okhttp3.Call createSceneStreamKeyAsync(UUID id, CreateStreamKeyRequest cr * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -242,7 +243,6 @@ public okhttp3.Call createSceneStreamKeyAsync(UUID id, CreateStreamKeyRequest cr */ public okhttp3.Call deleteStreamKeyCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -259,7 +259,7 @@ public okhttp3.Call deleteStreamKeyCall(UUID id, final ApiCallback _callback) th // create path and map variables String localVarPath = "/stream-keys/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -276,7 +276,6 @@ public okhttp3.Call deleteStreamKeyCall(UUID id, final ApiCallback _callback) th } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -289,15 +288,12 @@ public okhttp3.Call deleteStreamKeyCall(UUID id, final ApiCallback _callback) th @SuppressWarnings("rawtypes") private okhttp3.Call deleteStreamKeyValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteStreamKey(Async)"); } - - okhttp3.Call localVarCall = deleteStreamKeyCall(id, _callback); - return localVarCall; + return deleteStreamKeyCall(id, _callback); } @@ -307,7 +303,8 @@ private okhttp3.Call deleteStreamKeyValidateBeforeCall(UUID id, final ApiCallbac * @param id The `stream-key` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -326,7 +323,8 @@ public void deleteStreamKey(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -347,7 +345,8 @@ public ApiResponse deleteStreamKeyWithHttpInfo(UUID id) throws ApiExceptio * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -370,7 +369,8 @@ public okhttp3.Call deleteStreamKeyAsync(UUID id, final ApiCallback _callb * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -379,7 +379,6 @@ public okhttp3.Call deleteStreamKeyAsync(UUID id, final ApiCallback _callb */ public okhttp3.Call getStreamKeysCall(String pageCursor, Integer pageSize, String filterKey, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -424,7 +423,6 @@ public okhttp3.Call getStreamKeysCall(String pageCursor, Integer pageSize, Strin } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -437,10 +435,7 @@ public okhttp3.Call getStreamKeysCall(String pageCursor, Integer pageSize, Strin @SuppressWarnings("rawtypes") private okhttp3.Call getStreamKeysValidateBeforeCall(String pageCursor, Integer pageSize, String filterKey, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getStreamKeysCall(pageCursor, pageSize, filterKey, _callback); - return localVarCall; + return getStreamKeysCall(pageCursor, pageSize, filterKey, _callback); } @@ -453,7 +448,8 @@ private okhttp3.Call getStreamKeysValidateBeforeCall(String pageCursor, Integer * @return StreamKeyList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -474,7 +470,8 @@ public StreamKeyList getStreamKeys(String pageCursor, Integer pageSize, String f * @return ApiResponse<StreamKeyList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -497,7 +494,8 @@ public ApiResponse getStreamKeysWithHttpInfo(String pageCursor, I * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ diff --git a/src/main/java/com/vertexvis/api/TranslationInspectionsApi.java b/src/main/java/com/vertexvis/api/TranslationInspectionsApi.java index f21e7fd..72dc888 100644 --- a/src/main/java/com/vertexvis/api/TranslationInspectionsApi.java +++ b/src/main/java/com/vertexvis/api/TranslationInspectionsApi.java @@ -29,6 +29,7 @@ import com.vertexvis.model.CreateTranslationInspectionRequest; import com.vertexvis.model.Failure; +import com.vertexvis.model.FilterExpression; import com.vertexvis.model.QueuedJob; import com.vertexvis.model.QueuedJobList; import com.vertexvis.model.QueuedTranslationJob; @@ -85,7 +86,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -95,7 +97,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createTranslationInspectionCall(CreateTranslationInspectionRequest createTranslationInspectionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -141,15 +142,12 @@ public okhttp3.Call createTranslationInspectionCall(CreateTranslationInspectionR @SuppressWarnings("rawtypes") private okhttp3.Call createTranslationInspectionValidateBeforeCall(CreateTranslationInspectionRequest createTranslationInspectionRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createTranslationInspectionRequest' is set if (createTranslationInspectionRequest == null) { throw new ApiException("Missing the required parameter 'createTranslationInspectionRequest' when calling createTranslationInspection(Async)"); } - - okhttp3.Call localVarCall = createTranslationInspectionCall(createTranslationInspectionRequest, _callback); - return localVarCall; + return createTranslationInspectionCall(createTranslationInspectionRequest, _callback); } @@ -160,7 +158,8 @@ private okhttp3.Call createTranslationInspectionValidateBeforeCall(CreateTransla * @return TranslationInspectionJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -180,7 +179,8 @@ public TranslationInspectionJob createTranslationInspection(CreateTranslationIns * @return ApiResponse<TranslationInspectionJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -202,7 +202,8 @@ public ApiResponse createTranslationInspectionWithHttp * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -224,7 +225,8 @@ public okhttp3.Call createTranslationInspectionAsync(CreateTranslationInspection * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
400 Bad Request -
+
+ @@ -234,7 +236,6 @@ public okhttp3.Call createTranslationInspectionAsync(CreateTranslationInspection */ public okhttp3.Call getInspectionJobCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -251,7 +252,7 @@ public okhttp3.Call getInspectionJobCall(UUID id, final ApiCallback _callback) t // create path and map variables String localVarPath = "/translation-inspections/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -268,7 +269,6 @@ public okhttp3.Call getInspectionJobCall(UUID id, final ApiCallback _callback) t } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -281,15 +281,12 @@ public okhttp3.Call getInspectionJobCall(UUID id, final ApiCallback _callback) t @SuppressWarnings("rawtypes") private okhttp3.Call getInspectionJobValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getInspectionJob(Async)"); } - - okhttp3.Call localVarCall = getInspectionJobCall(id, _callback); - return localVarCall; + return getInspectionJobCall(id, _callback); } @@ -300,7 +297,8 @@ private okhttp3.Call getInspectionJobValidateBeforeCall(UUID id, final ApiCallba * @return TranslationInspectionJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -320,7 +318,8 @@ public TranslationInspectionJob getInspectionJob(UUID id) throws ApiException { * @return ApiResponse<TranslationInspectionJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -342,7 +341,8 @@ public ApiResponse getInspectionJobWithHttpInfo(UUID i * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -364,7 +364,8 @@ public okhttp3.Call getInspectionJobAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -377,7 +378,6 @@ public okhttp3.Call getInspectionJobAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -411,7 +411,6 @@ public okhttp3.Call getQueuedTranslationCall(UUID id, final ApiCallback _callbac } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -425,15 +424,12 @@ public okhttp3.Call getQueuedTranslationCall(UUID id, final ApiCallback _callbac @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedTranslationValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedTranslation(Async)"); } - - okhttp3.Call localVarCall = getQueuedTranslationCall(id, _callback); - return localVarCall; + return getQueuedTranslationCall(id, _callback); } @@ -444,7 +440,8 @@ private okhttp3.Call getQueuedTranslationValidateBeforeCall(UUID id, final ApiCa * @return QueuedJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -467,7 +464,8 @@ public QueuedJob getQueuedTranslation(UUID id) throws ApiException { * @return ApiResponse<QueuedJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -492,7 +490,8 @@ public ApiResponse getQueuedTranslationWithHttpInfo(UUID id) throws A * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -517,7 +516,8 @@ public okhttp3.Call getQueuedTranslationAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+ @@ -528,7 +528,6 @@ public okhttp3.Call getQueuedTranslationAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -562,7 +561,6 @@ public okhttp3.Call getQueuedTranslationJobCall(UUID id, final ApiCallback _call } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -575,15 +573,12 @@ public okhttp3.Call getQueuedTranslationJobCall(UUID id, final ApiCallback _call @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedTranslationJobValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getQueuedTranslationJob(Async)"); } - - okhttp3.Call localVarCall = getQueuedTranslationJobCall(id, _callback); - return localVarCall; + return getQueuedTranslationJobCall(id, _callback); } @@ -594,7 +589,8 @@ private okhttp3.Call getQueuedTranslationJobValidateBeforeCall(UUID id, final Ap * @return QueuedTranslationJob * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -615,7 +611,8 @@ public QueuedTranslationJob getQueuedTranslationJob(UUID id) throws ApiException * @return ApiResponse<QueuedTranslationJob> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -638,7 +635,8 @@ public ApiResponse getQueuedTranslationJobWithHttpInfo(UUI * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -658,12 +656,15 @@ public okhttp3.Call getQueuedTranslationJobAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+ @@ -671,9 +672,8 @@ public okhttp3.Call getQueuedTranslationJobAsync(UUID id, final ApiCallback
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public okhttp3.Call getQueuedTranslationJobsCall(String pageCursor, Integer pageSize, String filterStatus, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getQueuedTranslationJobsCall(String pageCursor, Integer pageSize, String sort, String filterStatus, FilterExpression filterCompletedAt, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -705,10 +705,18 @@ public okhttp3.Call getQueuedTranslationJobsCall(String pageCursor, Integer page localVarQueryParams.addAll(localVarApiClient.parameterToPair("page[size]", pageSize)); } + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + if (filterStatus != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[status]", filterStatus)); } + if (filterCompletedAt != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter[completedAt]", filterCompletedAt)); + } + final String[] localVarAccepts = { "application/vnd.api+json" }; @@ -718,7 +726,6 @@ public okhttp3.Call getQueuedTranslationJobsCall(String pageCursor, Integer page } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -730,11 +737,8 @@ public okhttp3.Call getQueuedTranslationJobsCall(String pageCursor, Integer page } @SuppressWarnings("rawtypes") - private okhttp3.Call getQueuedTranslationJobsValidateBeforeCall(String pageCursor, Integer pageSize, String filterStatus, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getQueuedTranslationJobsCall(pageCursor, pageSize, filterStatus, _callback); - return localVarCall; + private okhttp3.Call getQueuedTranslationJobsValidateBeforeCall(String pageCursor, Integer pageSize, String sort, String filterStatus, FilterExpression filterCompletedAt, final ApiCallback _callback) throws ApiException { + return getQueuedTranslationJobsCall(pageCursor, pageSize, sort, filterStatus, filterCompletedAt, _callback); } @@ -743,11 +747,14 @@ private okhttp3.Call getQueuedTranslationJobsValidateBeforeCall(String pageCurso * Get all current translation jobs in progress. * @param pageCursor The cursor for the next page of items. (optional) * @param pageSize The number of items to return. (optional) + * @param sort A sort to apply to the collection. A \"minus\" prefixed before the field name is used to specify descending sort order. (optional) * @param filterStatus Status to filter on. (optional) + * @param filterCompletedAt The completion date and time to filter on. (optional) * @return QueuedJobList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+ @@ -755,8 +762,8 @@ private okhttp3.Call getQueuedTranslationJobsValidateBeforeCall(String pageCurso
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public QueuedJobList getQueuedTranslationJobs(String pageCursor, Integer pageSize, String filterStatus) throws ApiException { - ApiResponse localVarResp = getQueuedTranslationJobsWithHttpInfo(pageCursor, pageSize, filterStatus); + public QueuedJobList getQueuedTranslationJobs(String pageCursor, Integer pageSize, String sort, String filterStatus, FilterExpression filterCompletedAt) throws ApiException { + ApiResponse localVarResp = getQueuedTranslationJobsWithHttpInfo(pageCursor, pageSize, sort, filterStatus, filterCompletedAt); return localVarResp.getData(); } @@ -765,11 +772,14 @@ public QueuedJobList getQueuedTranslationJobs(String pageCursor, Integer pageSiz * Get all current translation jobs in progress. * @param pageCursor The cursor for the next page of items. (optional) * @param pageSize The number of items to return. (optional) + * @param sort A sort to apply to the collection. A \"minus\" prefixed before the field name is used to specify descending sort order. (optional) * @param filterStatus Status to filter on. (optional) + * @param filterCompletedAt The completion date and time to filter on. (optional) * @return ApiResponse<QueuedJobList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+ @@ -777,8 +787,8 @@ public QueuedJobList getQueuedTranslationJobs(String pageCursor, Integer pageSiz
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public ApiResponse getQueuedTranslationJobsWithHttpInfo(String pageCursor, Integer pageSize, String filterStatus) throws ApiException { - okhttp3.Call localVarCall = getQueuedTranslationJobsValidateBeforeCall(pageCursor, pageSize, filterStatus, null); + public ApiResponse getQueuedTranslationJobsWithHttpInfo(String pageCursor, Integer pageSize, String sort, String filterStatus, FilterExpression filterCompletedAt) throws ApiException { + okhttp3.Call localVarCall = getQueuedTranslationJobsValidateBeforeCall(pageCursor, pageSize, sort, filterStatus, filterCompletedAt, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -788,12 +798,15 @@ public ApiResponse getQueuedTranslationJobsWithHttpInfo(String pa * Get all current translation jobs in progress. * @param pageCursor The cursor for the next page of items. (optional) * @param pageSize The number of items to return. (optional) + * @param sort A sort to apply to the collection. A \"minus\" prefixed before the field name is used to specify descending sort order. (optional) * @param filterStatus Status to filter on. (optional) + * @param filterCompletedAt The completion date and time to filter on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+ @@ -801,9 +814,9 @@ public ApiResponse getQueuedTranslationJobsWithHttpInfo(String pa
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public okhttp3.Call getQueuedTranslationJobsAsync(String pageCursor, Integer pageSize, String filterStatus, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getQueuedTranslationJobsAsync(String pageCursor, Integer pageSize, String sort, String filterStatus, FilterExpression filterCompletedAt, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = getQueuedTranslationJobsValidateBeforeCall(pageCursor, pageSize, filterStatus, _callback); + okhttp3.Call localVarCall = getQueuedTranslationJobsValidateBeforeCall(pageCursor, pageSize, sort, filterStatus, filterCompletedAt, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; @@ -817,7 +830,8 @@ public okhttp3.Call getQueuedTranslationJobsAsync(String pageCursor, Integer pag * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+ @@ -830,7 +844,6 @@ public okhttp3.Call getQueuedTranslationJobsAsync(String pageCursor, Integer pag @Deprecated public okhttp3.Call getQueuedTranslationsCall(String pageCursor, Integer pageSize, String filterStatus, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -875,7 +888,6 @@ public okhttp3.Call getQueuedTranslationsCall(String pageCursor, Integer pageSiz } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -889,10 +901,7 @@ public okhttp3.Call getQueuedTranslationsCall(String pageCursor, Integer pageSiz @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getQueuedTranslationsValidateBeforeCall(String pageCursor, Integer pageSize, String filterStatus, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getQueuedTranslationsCall(pageCursor, pageSize, filterStatus, _callback); - return localVarCall; + return getQueuedTranslationsCall(pageCursor, pageSize, filterStatus, _callback); } @@ -905,7 +914,8 @@ private okhttp3.Call getQueuedTranslationsValidateBeforeCall(String pageCursor, * @return QueuedJobList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -930,7 +940,8 @@ public QueuedJobList getQueuedTranslations(String pageCursor, Integer pageSize, * @return ApiResponse<QueuedJobList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -957,7 +968,8 @@ public ApiResponse getQueuedTranslationsWithHttpInfo(String pageC * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ diff --git a/src/main/java/com/vertexvis/api/WebhookSubscriptionsApi.java b/src/main/java/com/vertexvis/api/WebhookSubscriptionsApi.java index 1471b23..b9c65b3 100644 --- a/src/main/java/com/vertexvis/api/WebhookSubscriptionsApi.java +++ b/src/main/java/com/vertexvis/api/WebhookSubscriptionsApi.java @@ -84,7 +84,8 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
301 Moved Permanently -
+
+ @@ -93,7 +94,6 @@ public void setCustomBaseUrl(String customBaseUrl) { */ public okhttp3.Call createWebhookSubscriptionCall(CreateWebhookSubscriptionRequest createWebhookSubscriptionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -139,15 +139,12 @@ public okhttp3.Call createWebhookSubscriptionCall(CreateWebhookSubscriptionReque @SuppressWarnings("rawtypes") private okhttp3.Call createWebhookSubscriptionValidateBeforeCall(CreateWebhookSubscriptionRequest createWebhookSubscriptionRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createWebhookSubscriptionRequest' is set if (createWebhookSubscriptionRequest == null) { throw new ApiException("Missing the required parameter 'createWebhookSubscriptionRequest' when calling createWebhookSubscription(Async)"); } - - okhttp3.Call localVarCall = createWebhookSubscriptionCall(createWebhookSubscriptionRequest, _callback); - return localVarCall; + return createWebhookSubscriptionCall(createWebhookSubscriptionRequest, _callback); } @@ -158,7 +155,8 @@ private okhttp3.Call createWebhookSubscriptionValidateBeforeCall(CreateWebhookSu * @return WebhookSubscription * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -177,7 +175,8 @@ public WebhookSubscription createWebhookSubscription(CreateWebhookSubscriptionRe * @return ApiResponse<WebhookSubscription> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -198,7 +197,8 @@ public ApiResponse createWebhookSubscriptionWithHttpInfo(Cr * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -219,7 +219,8 @@ public okhttp3.Call createWebhookSubscriptionAsync(CreateWebhookSubscriptionRequ * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
201 Created * location -
401 Unauthorized -
+
+ @@ -229,7 +230,6 @@ public okhttp3.Call createWebhookSubscriptionAsync(CreateWebhookSubscriptionRequ */ public okhttp3.Call deleteWebhookSubscriptionCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -246,7 +246,7 @@ public okhttp3.Call deleteWebhookSubscriptionCall(UUID id, final ApiCallback _ca // create path and map variables String localVarPath = "/webhook-subscriptions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -263,7 +263,6 @@ public okhttp3.Call deleteWebhookSubscriptionCall(UUID id, final ApiCallback _ca } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -276,15 +275,12 @@ public okhttp3.Call deleteWebhookSubscriptionCall(UUID id, final ApiCallback _ca @SuppressWarnings("rawtypes") private okhttp3.Call deleteWebhookSubscriptionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling deleteWebhookSubscription(Async)"); } - - okhttp3.Call localVarCall = deleteWebhookSubscriptionCall(id, _callback); - return localVarCall; + return deleteWebhookSubscriptionCall(id, _callback); } @@ -294,7 +290,8 @@ private okhttp3.Call deleteWebhookSubscriptionValidateBeforeCall(UUID id, final * @param id The `webhook-subscription` ID. (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -313,7 +310,8 @@ public void deleteWebhookSubscription(UUID id) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -334,7 +332,8 @@ public ApiResponse deleteWebhookSubscriptionWithHttpInfo(UUID id) throws A * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+
+ @@ -355,7 +354,8 @@ public okhttp3.Call deleteWebhookSubscriptionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
204 No Content -
401 Unauthorized -
+ @@ -365,7 +365,6 @@ public okhttp3.Call deleteWebhookSubscriptionAsync(UUID id, final ApiCallback localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -399,7 +398,6 @@ public okhttp3.Call getWebhookSubscriptionCall(UUID id, final ApiCallback _callb } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -412,15 +410,12 @@ public okhttp3.Call getWebhookSubscriptionCall(UUID id, final ApiCallback _callb @SuppressWarnings("rawtypes") private okhttp3.Call getWebhookSubscriptionValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getWebhookSubscription(Async)"); } - - okhttp3.Call localVarCall = getWebhookSubscriptionCall(id, _callback); - return localVarCall; + return getWebhookSubscriptionCall(id, _callback); } @@ -431,7 +426,8 @@ private okhttp3.Call getWebhookSubscriptionValidateBeforeCall(UUID id, final Api * @return WebhookSubscription * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -451,7 +447,8 @@ public WebhookSubscription getWebhookSubscription(UUID id) throws ApiException { * @return ApiResponse<WebhookSubscription> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -473,7 +470,8 @@ public ApiResponse getWebhookSubscriptionWithHttpInfo(UUID * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -496,7 +494,8 @@ public okhttp3.Call getWebhookSubscriptionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -505,7 +504,6 @@ public okhttp3.Call getWebhookSubscriptionAsync(UUID id, final ApiCallback +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ @@ -594,7 +589,8 @@ public WebhookSubscriptionList getWebhookSubscriptions(String pageCursor, Intege * @return ApiResponse<WebhookSubscriptionList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -616,7 +612,8 @@ public ApiResponse getWebhookSubscriptionsWithHttpInfo( * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -638,7 +635,8 @@ public okhttp3.Call getWebhookSubscriptionsAsync(String pageCursor, Integer page * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+
+ @@ -649,7 +647,6 @@ public okhttp3.Call getWebhookSubscriptionsAsync(String pageCursor, Integer page */ public okhttp3.Call updateWebhookSubscriptionCall(UUID id, UpdateWebhookSubscriptionRequest updateWebhookSubscriptionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; - // Operation Servers String[] localBasePaths = new String[] { }; @@ -666,7 +663,7 @@ public okhttp3.Call updateWebhookSubscriptionCall(UUID id, UpdateWebhookSubscrip // create path and map variables String localVarPath = "/webhook-subscriptions/{id}" - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -696,20 +693,17 @@ public okhttp3.Call updateWebhookSubscriptionCall(UUID id, UpdateWebhookSubscrip @SuppressWarnings("rawtypes") private okhttp3.Call updateWebhookSubscriptionValidateBeforeCall(UUID id, UpdateWebhookSubscriptionRequest updateWebhookSubscriptionRequest, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateWebhookSubscription(Async)"); } - + // verify the required parameter 'updateWebhookSubscriptionRequest' is set if (updateWebhookSubscriptionRequest == null) { throw new ApiException("Missing the required parameter 'updateWebhookSubscriptionRequest' when calling updateWebhookSubscription(Async)"); } - - okhttp3.Call localVarCall = updateWebhookSubscriptionCall(id, updateWebhookSubscriptionRequest, _callback); - return localVarCall; + return updateWebhookSubscriptionCall(id, updateWebhookSubscriptionRequest, _callback); } @@ -721,7 +715,8 @@ private okhttp3.Call updateWebhookSubscriptionValidateBeforeCall(UUID id, Update * @return WebhookSubscription * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -743,7 +738,8 @@ public WebhookSubscription updateWebhookSubscription(UUID id, UpdateWebhookSubsc * @return ApiResponse<WebhookSubscription> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ @@ -767,7 +763,8 @@ public ApiResponse updateWebhookSubscriptionWithHttpInfo(UU * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
+
+ diff --git a/src/main/java/com/vertexvis/auth/ApiKeyAuth.java b/src/main/java/com/vertexvis/auth/ApiKeyAuth.java index ac77f0c..dfb9eb8 100644 --- a/src/main/java/com/vertexvis/auth/ApiKeyAuth.java +++ b/src/main/java/com/vertexvis/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/com/vertexvis/auth/HttpBasicAuth.java b/src/main/java/com/vertexvis/auth/HttpBasicAuth.java index 335f887..aa11aed 100644 --- a/src/main/java/com/vertexvis/auth/HttpBasicAuth.java +++ b/src/main/java/com/vertexvis/auth/HttpBasicAuth.java @@ -22,8 +22,6 @@ import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; - public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/src/main/java/com/vertexvis/auth/HttpBearerAuth.java b/src/main/java/com/vertexvis/auth/HttpBearerAuth.java index 9e45f45..97bc8eb 100644 --- a/src/main/java/com/vertexvis/auth/HttpBearerAuth.java +++ b/src/main/java/com/vertexvis/auth/HttpBearerAuth.java @@ -17,13 +17,15 @@ import com.vertexvis.Pair; import java.net.URI; -import java.util.Map; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -35,7 +37,7 @@ public HttpBearerAuth(String scheme) { * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** @@ -44,12 +46,22 @@ public String getBearerToken() { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); if (bearerToken == null) { return; } diff --git a/src/main/java/com/vertexvis/auth/OAuth.java b/src/main/java/com/vertexvis/auth/OAuth.java index 28edcbe..27eb650 100644 --- a/src/main/java/com/vertexvis/auth/OAuth.java +++ b/src/main/java/com/vertexvis/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class OAuth implements Authentication { private String accessToken; diff --git a/src/main/java/com/vertexvis/auth/OAuthFlow.java b/src/main/java/com/vertexvis/auth/OAuthFlow.java index 140db09..5249673 100644 --- a/src/main/java/com/vertexvis/auth/OAuthFlow.java +++ b/src/main/java/com/vertexvis/auth/OAuthFlow.java @@ -13,10 +13,13 @@ package com.vertexvis.auth; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public enum OAuthFlow { - accessCode, //called authorizationCode in OpenAPI 3.0 - implicit, - password, - application //called clientCredentials in OpenAPI 3.0 + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 } diff --git a/src/main/java/com/vertexvis/auth/OAuthOkHttpClient.java b/src/main/java/com/vertexvis/auth/OAuthOkHttpClient.java index 2384a72..ce5c57f 100644 --- a/src/main/java/com/vertexvis/auth/OAuthOkHttpClient.java +++ b/src/main/java/com/vertexvis/auth/OAuthOkHttpClient.java @@ -1,3 +1,16 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.vertexvis.auth; import okhttp3.OkHttpClient; @@ -18,7 +31,7 @@ import java.util.Map.Entry; public class OAuthOkHttpClient implements HttpClient { - private final OkHttpClient client; + private OkHttpClient client; public OAuthOkHttpClient() { this.client = new OkHttpClient(); @@ -55,6 +68,7 @@ public T execute(OAuthClientRequest request, Map response.body().string(), response.body().contentType().toString(), response.code(), + response.headers().toMultimap(), responseClass); } catch (IOException e) { throw new OAuthSystemException(e); diff --git a/src/main/java/com/vertexvis/auth/RetryingOAuth.java b/src/main/java/com/vertexvis/auth/RetryingOAuth.java index 964303b..ef9e6e8 100644 --- a/src/main/java/com/vertexvis/auth/RetryingOAuth.java +++ b/src/main/java/com/vertexvis/auth/RetryingOAuth.java @@ -1,18 +1,26 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.vertexvis.auth; +import com.vertexvis.ApiException; import com.vertexvis.Pair; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URI; -import java.util.List; -import java.util.Map; - -import okhttp3.Credentials; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; + import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; @@ -21,148 +29,195 @@ import org.apache.oltu.oauth2.common.exception.OAuthProblemException; import org.apache.oltu.oauth2.common.exception.OAuthSystemException; import org.apache.oltu.oauth2.common.message.types.GrantType; -import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; public class RetryingOAuth extends OAuth implements Interceptor { - private final OAuthClient oAuthClient; - private final TokenRequestBuilder tokenRequestBuilder; - - public RetryingOAuth( - String tokenUrl, - String clientId, - OAuthFlow flow, - String clientSecret, - Map parameters - ) { - this.oAuthClient = new OAuthClient(new OAuthOkHttpClient( - new OkHttpClient.Builder() - .addInterceptor(new AuthInterceptor(clientId, clientSecret)) - .build())); - this.tokenRequestBuilder = OAuthClientRequest.tokenLocation(tokenUrl); - setFlow(flow); - if (parameters != null) { - for (String paramName : parameters.keySet()) { - tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); - } - } - } + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; - public void setFlow(OAuthFlow flow) { - if (flow == OAuthFlow.application) { - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; } - } - @NotNull - @Override - public Response intercept(Chain chain) throws IOException { - return retryingIntercept(chain, true); - } + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } - private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) - throws IOException { - Request request = chain.request(); + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } - // If the request already has an authorization (e.g. Basic auth), proceed with the request as is - if (request.header("Authorization") != null) { - return chain.proceed(request); + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } } - // Get the token if it has not yet been acquired - if (getAccessToken() == null) { - updateAccessToken(null); + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); } - OAuthClientRequest oAuthRequest; - if (getAccessToken() != null) { - // Build the request - Request.Builder requestBuilder = request.newBuilder(); - - String requestAccessToken = getAccessToken(); - try { - oAuthRequest = - new OAuthBearerClientRequest(request.url().toString()). - setAccessToken(requestAccessToken). - buildHeaderMessage(); - } catch (OAuthSystemException e) { - throw new IOException(e); - } - - Map headers = oAuthRequest.getHeaders(); - for (String headerName : headers.keySet()) { - requestBuilder.addHeader(headerName, headers.get(headerName)); - } - requestBuilder.url(oAuthRequest.getLocationUri()); - - // Execute the request - Response response = chain.proceed(requestBuilder.build()); - - // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row - if ( - (response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || - response.code() == HttpURLConnection.HTTP_FORBIDDEN) && - updateTokenAndRetryOnAuthorizationFailure - ) { - try { - updateAccessToken(requestAccessToken); - response.body().close(); - return retryingIntercept(chain, false); - } catch (Exception e) { - response.body().close(); - throw e; + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); } - } - return response; - } else { - return chain.proceed(chain.request()); } - } - - private synchronized void updateAccessToken(String requestAccessToken) throws IOException { - // if we don't have a token at all, we go get one - // if we are here and requestAccessToken is not equal to getAccessToken(), that means - // some other thread has already updated the token and we can just continue on to retry with the new token. - if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { - try { - OAuthJSONAccessTokenResponse accessTokenResponse = - oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken()); + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } } - } catch (OAuthSystemException | OAuthProblemException e) { - throw new IOException(e); - } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); } - } - - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; - } - - // Applying authorization to parameters is performed in the retryingIntercept method - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) { - // No implementation necessary - } - - private static class AuthInterceptor implements Interceptor { - private final String clientId; - private final String clientSecret; - - public AuthInterceptor(String clientId, String clientSecret) { - this.clientId = clientId; - this.clientSecret = clientSecret; + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; } - @NotNull + // Applying authorization to parameters is performed in the retryingIntercept method @Override - public Response intercept(Chain chain) throws IOException { - return chain.proceed( - chain.request() - .newBuilder().addHeader("Authorization", Credentials.basic(clientId, clientSecret)) - .build() - ); + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary } - } } diff --git a/src/main/java/com/vertexvis/example/CallbackUtil.java b/src/main/java/com/vertexvis/example/CallbackUtil.java deleted file mode 100644 index 9ce12a9..0000000 --- a/src/main/java/com/vertexvis/example/CallbackUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.ApiCallback; -import com.vertexvis.ApiException; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.function.Consumer; - -class CallbackUtil { - public static CompletableFuture execute(Consumer> callbackConsumer) { - CompletableFuture cf = new CompletableFuture<>(); - - callbackConsumer.accept(new ApiCallback() { - @Override - public void onFailure(ApiException e, int statusCode, - Map> responseHeaders) { - cf.completeExceptionally(e); - } - - @Override - public void onSuccess(T result, int statusCode, Map> responseHeaders) { - cf.complete(result); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - - } - }); - - return cf; - } -} diff --git a/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java b/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java deleted file mode 100644 index e30afc7..0000000 --- a/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.ApiCallback; -import com.vertexvis.ApiClient; -import com.vertexvis.ApiException; -import com.vertexvis.api.FilesApi; -import com.vertexvis.example.cmdline.CommandLineOptions; -import com.vertexvis.model.*; -import picocli.CommandLine; - -import java.io.File; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.vertexvis.example.CallbackUtil.execute; - -public class CreateAssemblyFromRevisionsExample extends CommandLineOptions { - private static final Logger logger = Logger.getLogger(CreateAssemblyFromRevisionsExample.class.getName()); - - @Override - public void run() { - String clientId = getClientId(); - String secret = getClientSecret(); - if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { - throw new CommandLine.ParameterException(getSpec().commandLine(), - "Environment variables [VERTEX_CLIENT_ID] [VERTEX_CLIENT_SECRET] or command line options " + - "[--clientId]" + - "[--clientSecret]" + - "containing your Vertex client ID and secret are required." - ); - } - - ApiClient client = - new ApiClient(getVertexApiUrl(), clientId, secret, new HashMap<>()).setDebugging(isVerboseDebugLogging()); - - PartCreator pc = new PartCreator(client); - FilesApi files = new FilesApi(client); - SceneCreator sc = new SceneCreator(client); - - - List> futureParts = getPartFiles().stream() - .map(CreateAssemblyFromRevisionsExample::buildCreateFileReq) - .map(req -> createAndUploadFile(files, req) - .thenCompose(partId -> pc.createPartFromFileAsync(partId, req))) - .toList(); - - CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); - List newParts = futureParts.stream() - .map(CompletableFuture::join) - .toList(); - newParts.forEach(p -> logger.info("Created part: " + p.getData().getId() + " with name " + - p.getData().getAttributes().getName())); - - try { - Part assembly = newParts.stream() - .map(part -> part.getData().getRelationships().getPartRevisions()) - .flatMap(Collection::stream) - .map(PartDataRelationshipsPartRevisions::getId) - .peek(uuid -> logger.info(uuid.toString())) - .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) - .handle((part, ex) -> { - if (ex != null) { - if (ex.getCause() instanceof ApiException) { - logger.log(Level.SEVERE, ((ApiException) ex.getCause()).getResponseBody(), ex.getCause()); - } - logger.log(Level.SEVERE, ex.getCause().getMessage(), ex); - return null; - } else { - return part; - } - }).join(); - - logger.info("Created assembly: " + assembly.getData().getId() + " with name " + - assembly.getData().getAttributes().getName()); - var scene = sc.createSceneFromPart(assembly); - logger.info("Created scene: " + scene.getData().getId() + " with name " + - scene.getData().getAttributes().getName()); - } catch (ApiException e) { - logger.log(Level.SEVERE, "Error Code [" + e.getCode() + "], Response body " + e.getResponseBody(), e); - } catch (InterruptedException e) { - logger.severe(e.getMessage()); - // Restore interrupted state... - Thread.currentThread().interrupt(); - } - } - - public static void main(String[] args) { - - var exitCode = new CommandLine(new CreateAssemblyFromRevisionsExample()).execute(args); - System.exit(exitCode); - } - - private static CompletableFuture createAndUploadFile(FilesApi files, - CreateFileRequest req) { - return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) - .thenCompose( - md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); - } - - private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { - return execute((ApiCallback uCB) -> - files.uploadFileAsync(id, new File(name), uCB)) - .thenApply((Void) -> id); - } - - - private static CreateFileRequest buildCreateFileReq(String fileName) { - return new CreateFileRequest() - .data( - new CreateFileRequestData() - .type("file") - .attributes(new CreateFileRequestDataAttributes().name(fileName))); - } - - - private static boolean isNullOrEmpty(String s) { - return s == null || s.trim().length() == 0; - } - - -} diff --git a/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java b/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java deleted file mode 100644 index 3798f00..0000000 --- a/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.ApiCallback; -import com.vertexvis.ApiClient; -import com.vertexvis.ApiException; -import com.vertexvis.api.FilesApi; -import com.vertexvis.example.cmdline.CommandLineOptions; -import com.vertexvis.model.*; -import picocli.CommandLine; - -import java.io.File; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.vertexvis.example.CallbackUtil.execute; - -public class CreatePartRevisionsWithMetadataExample extends CommandLineOptions { - private static final Logger logger = Logger.getLogger(CreatePartRevisionsWithMetadataExample.class.getName()); - - @Override - public void run() { - String clientId = getClientId(); - String secret = getClientSecret(); - if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { - throw new CommandLine.ParameterException(getSpec().commandLine(), - "Environment variables [VERTEX_CLIENT_ID] [VERTEX_CLIENT_SECRET] or command line options " + - "[--clientId]" + - "[--clientSecret]" + - "containing your Vertex client ID and secret are required." - ); - } - - ApiClient client = - new ApiClient(getVertexApiUrl(), clientId, secret, new HashMap<>()).setDebugging(isVerboseDebugLogging()); - - PartCreator pc = new PartCreator(client); - FilesApi files = new FilesApi(client); - SceneCreator sc = new SceneCreator(client); - - var partMetadata = MetadataUtil.createCustomMetadata(getMetadataCount()); - List> futureParts = getPartFiles().stream() - .map(CreatePartRevisionsWithMetadataExample::buildCreateFileReq) - .map(req -> createAndUploadFile(files, req) - .thenCompose(partId -> pc.createPartFromFileAsync(partId, req, partMetadata))) - .toList(); - - CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); - List newParts = futureParts.stream() - .map(CompletableFuture::join) - .toList(); - newParts.forEach(p -> logger.info("Created part: " + p.getData().getId() + " with name " + - p.getData().getAttributes().getName())); - - try { - Part assembly = newParts.stream() - .map(part -> part.getData().getRelationships().getPartRevisions()) - .flatMap(Collection::stream) - .map(PartDataRelationshipsPartRevisions::getId) - .peek(uuid -> logger.info("Part Revision Id: " + uuid)) - .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) - .handle((part, ex) -> { - if (ex != null) { - if (ex.getCause() instanceof ApiException) { - logger.log(Level.SEVERE, ((ApiException) ex.getCause()).getResponseBody(), ex.getCause()); - } - logger.log(Level.SEVERE, ex.getCause().getMessage(), ex); - return null; - } else { - return part; - } - }).join(); - - logger.info("Created assembly: " + assembly.getData().getId() + " with name " + - assembly.getData().getAttributes().getName()); - var scene = sc.createSceneFromPart(assembly); - logger.info("Created scene: " + scene.getData().getId() + " with name " + - scene.getData().getAttributes().getName()); - logger.info("Each Part Revision has: " + getMetadataCount() + " custom metadata items"); - } catch (ApiException e) { - logger.log(Level.SEVERE, "Error Code [" + e.getCode() + "], Response body " + e.getResponseBody(), e); - } catch (InterruptedException e) { - logger.severe(e.getMessage()); - // Restore interrupted state... - Thread.currentThread().interrupt(); - } - } - - public static void main(String[] args) { - - var exitCode = new CommandLine(new CreatePartRevisionsWithMetadataExample()).execute(args); - System.exit(exitCode); - } - - private static CompletableFuture createAndUploadFile(FilesApi files, - CreateFileRequest req) { - return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) - .thenCompose( - md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); - } - - private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { - return execute((ApiCallback uCB) -> - files.uploadFileAsync(id, new File(name), uCB)) - .thenApply((Void) -> id); - } - - - private static CreateFileRequest buildCreateFileReq(String fileName) { - return new CreateFileRequest() - .data( - new CreateFileRequestData() - .type("file") - .attributes(new CreateFileRequestDataAttributes().name(fileName))); - } - - - private static boolean isNullOrEmpty(String s) { - return s == null || s.trim().length() == 0; - } - -} diff --git a/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java b/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java deleted file mode 100644 index f333e66..0000000 --- a/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.vertexvis.example; - -import static com.vertexvis.example.CallbackUtil.execute; - - -import com.vertexvis.ApiCallback; -import com.vertexvis.ApiClient; -import com.vertexvis.api.FilesApi; -import com.vertexvis.model.CreateFileRequest; -import com.vertexvis.model.CreateFileRequestData; -import com.vertexvis.model.CreateFileRequestDataAttributes; -import com.vertexvis.model.FileMetadata; -import com.vertexvis.model.Part; - -import java.io.File; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class CreatePartsAsyncExample { - public static void main(String[] args) { - String clientId = System.getenv("VERTEX_CLIENT_ID"); - String secret = System.getenv("VERTEX_CLIENT_SECRET"); - if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { - throw new RuntimeException( - "Environment variables containing your Vertex client ID and secret are required." - ); - } - - ApiClient client = - new ApiClient("https://platform.vertexvis.com", clientId, secret, new HashMap<>()); - - PartCreator pc = new PartCreator(client); - FilesApi files = new FilesApi(client); - - List> futureParts = Stream.of("file-1.jt", "file-2.jt", "file-3.jt") - .map(CreatePartsAsyncExample::buildCreateFileReq) - .map(req -> createAndUploadFile(files, req).thenCompose(partId -> pc.createPartFromFileAsync(partId, req))) - .collect(Collectors.toList()); - - CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); - futureParts.stream() - .map(CompletableFuture::join) - .forEach(p -> System.out.println("Created part: " + p.getData().getId() + " with name " + - p.getData().getAttributes().getName())); - - System.exit(0); - } - - private static CompletableFuture createAndUploadFile(FilesApi files, - CreateFileRequest req) { - return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) - .thenCompose( - md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); - } - - private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { - return execute((ApiCallback uCB) -> - files.uploadFileAsync(id, new File("/path/to/" + name), uCB)) - .thenApply((Void) -> id); - } - - private static CreateFileRequest buildCreateFileReq(String fileName) { - return new CreateFileRequest() - .data( - new CreateFileRequestData() - .type("file") - .attributes(new CreateFileRequestDataAttributes().name(fileName))); - } - - - private static boolean isNullOrEmpty(String s) { - return s == null || s.trim().length() == 0; - } -} diff --git a/src/main/java/com/vertexvis/example/CreateSceneExample.java b/src/main/java/com/vertexvis/example/CreateSceneExample.java deleted file mode 100644 index 1ea8a35..0000000 --- a/src/main/java/com/vertexvis/example/CreateSceneExample.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.ApiClient; -import com.vertexvis.api.FilesApi; -import com.vertexvis.api.StreamKeysApi; -import com.vertexvis.model.CreateFileRequest; -import com.vertexvis.model.CreateFileRequestData; -import com.vertexvis.model.CreateFileRequestDataAttributes; -import com.vertexvis.model.CreateStreamKeyRequest; -import com.vertexvis.model.CreateStreamKeyRequestData; -import com.vertexvis.model.CreateStreamKeyRequestDataAttributes; -import com.vertexvis.model.FileMetadata; -import com.vertexvis.model.Part; -import com.vertexvis.model.Scene; -import com.vertexvis.model.StreamKey; - -import java.io.File; -import java.util.HashMap; -import java.util.UUID; - -public class CreateSceneExample { - public static void main(String[] args) throws InterruptedException { - String id = System.getenv("VERTEX_CLIENT_ID"); - String secret = System.getenv("VERTEX_CLIENT_SECRET"); - if (isNullOrEmpty(id) || isNullOrEmpty(secret)) { - throw new RuntimeException( - "Environment variables containing your Vertex client ID and secret are required." - ); - } - - try { - ApiClient client = - new ApiClient("https://platform.vertexvis.com", id, secret, new HashMap<>()); - - PartCreator partCreator = new PartCreator(client); - SceneCreator sceneCreator = new SceneCreator(client); - FilesApi files = new FilesApi(client); - - FileMetadata file = files.createFile(buildCreateFileReq("my-file.jt")); - UUID fileId = file.getData().getId(); - files.uploadFile(fileId, new File("/path/to/my-file.jt")); - - Part part = partCreator.createPartFromFile(file); - Scene scene = sceneCreator.createSceneFromPart(part); - - StreamKey sceneStreamKey = - new StreamKeysApi(client).createSceneStreamKey(scene.getData().getId(), - buildCreateStreamKeyReq()); - - System.out.println( - "Use key: '" - + sceneStreamKey.getData().getAttributes().getKey() - + "' to render scene: " - + scene.getData().getId()); - } catch (RuntimeException e) { - e.printStackTrace(); - } - } - - private static CreateStreamKeyRequest buildCreateStreamKeyReq() { - int TWENTY_FOUR_HOURS = 86400; - return new CreateStreamKeyRequest() - .data( - new CreateStreamKeyRequestData() - .type("stream-key") - .attributes( - new CreateStreamKeyRequestDataAttributes().expiry(TWENTY_FOUR_HOURS))); - } - - private static CreateFileRequest buildCreateFileReq(String fileName) { - return new CreateFileRequest() - .data( - new CreateFileRequestData() - .type("file") - .attributes(new CreateFileRequestDataAttributes().name(fileName))); - } - - private static boolean isNullOrEmpty(String s) { - return s == null || s.trim().length() == 0; - } -} diff --git a/src/main/java/com/vertexvis/example/JobPoller.java b/src/main/java/com/vertexvis/example/JobPoller.java deleted file mode 100644 index fda8853..0000000 --- a/src/main/java/com/vertexvis/example/JobPoller.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.model.QueuedJob; - -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -class JobPoller { - private static final long DEFAULT_WAIT_TIME_MS = 3000; - - private static final ScheduledExecutorService scheduler = - Executors.newScheduledThreadPool(4); - - public static CompletableFuture pollUntilJobDoneAsync(String type, - Supplier> f) { - CompletableFuture cf = new CompletableFuture<>(); - - startChecking(cf, type, f); - - return cf; - } - - public static UUID pollUntilJobDone(String type, Supplier f) - throws InterruptedException { - // Don't do this -- use a proper scheduler - Thread.sleep(DEFAULT_WAIT_TIME_MS); - - QueuedJob qj = f.get(); - - if (qj.getData().getType().equals(type)) { - return qj.getData().getId(); - } else { - return pollUntilJobDone(type, f); - } - } - - private static void startChecking(CompletableFuture resultF, String type, - Supplier> f) { - scheduler.schedule(() -> { - f.get().thenAccept(qj -> { - if (qj.getData().getType().equals(type)) { - resultF.complete(qj.getData().getId()); - } else { - startChecking(resultF, type, f); - } - }); - - }, DEFAULT_WAIT_TIME_MS, TimeUnit.MILLISECONDS); - } -} diff --git a/src/main/java/com/vertexvis/example/MetadataUtil.java b/src/main/java/com/vertexvis/example/MetadataUtil.java deleted file mode 100644 index 4e2df07..0000000 --- a/src/main/java/com/vertexvis/example/MetadataUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.model.*; - -import java.time.OffsetDateTime; -import java.util.AbstractMap; -import java.util.Map; -import java.util.UUID; -import java.util.random.RandomGenerator; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -public class MetadataUtil { - - enum MetadataType { - LONG, - FLOAT, - DATE, - STRING, - NULL - } - - public static Map createCustomMetadata(int numberOfMetadataProperties) { - return IntStream.range(0, numberOfMetadataProperties).mapToObj(i -> { - // generate key that index of the number of metadata properties - var key = "key_0" + (i + 1) + "/" + numberOfMetadataProperties; - var random = RandomGenerator.getDefault(); - var metadataType = random.nextInt(MetadataType.values().length); - var value = switch (MetadataType.values()[metadataType]) { - case LONG -> - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataLongType().type("long").value(random.nextLong())); - - case FLOAT -> - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataFloatType().type("float").value(random.nextFloat())); - case DATE -> - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataDateType().type("date").value(OffsetDateTime.now())); - case STRING -> - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataStringType().type("string").value(UUID.randomUUID().toString())); - case NULL -> - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataNullType().type("null")); - - }; - // return a map entry of key and value - return new AbstractMap.SimpleEntry<>(key, value); - - }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - - } - -} diff --git a/src/main/java/com/vertexvis/example/PartCreator.java b/src/main/java/com/vertexvis/example/PartCreator.java deleted file mode 100644 index 190af76..0000000 --- a/src/main/java/com/vertexvis/example/PartCreator.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.vertexvis.example; - -import com.vertexvis.ApiCallback; -import com.vertexvis.ApiClient; -import com.vertexvis.api.PartsApi; -import com.vertexvis.api.TranslationInspectionsApi; -import com.vertexvis.model.*; - -import java.math.BigDecimal; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static com.vertexvis.example.CallbackUtil.execute; - -class PartCreator { - private final TranslationInspectionsApi tiApi; - private final PartsApi parts; - - public PartCreator(ApiClient client) { - this.parts = new PartsApi(client); - this.tiApi = new TranslationInspectionsApi(client); - } - - public Part createPartFromFile(FileMetadata metadata) throws InterruptedException { - return createPartFromFile(metadata, Collections.emptyMap()); - } - - public Part createPartFromFile(FileMetadata metadata, Map partMetadata) throws InterruptedException { - Part qp = parts.createPart(getCreatePartRequest(metadata.getData().getId(), metadata.getData().getAttributes().getName(), partMetadata)); - UUID partId = - JobPoller.pollUntilJobDone("part", () -> tiApi.getQueuedTranslation(qp.getData().getId())); - return parts.getPart(partId, null); - } - - public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req) { - return createPartFromFileAsync(id, req, Collections.emptyMap()); - } - - public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req, Map metadata) { - CompletableFuture p = - execute(cb -> parts.createPartAsync(getCreatePartRequest(id, req.getData().getAttributes().getName(), metadata), cb)); - CompletableFuture partId = p.thenCompose(qj -> - JobPoller.pollUntilJobDoneAsync("part", () -> - execute(cb -> tiApi.getQueuedTranslationAsync(qj.getData().getId(), cb)))); - - return partId.thenCompose( - pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId, null, cb))); - } - - public CompletableFuture createAssemblyFromRevisions(List revisions, String name) { - CompletableFuture p = - execute(cb -> parts.createPartAsync(createPartAssemblyRequest(revisions, name), cb)); - return p.thenCompose( - pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId.getData().getId(), null, cb))); - } - - private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName) { - return getCreatePartRequest(fileId, partName, Collections.emptyMap()); - } - - private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName, Map metadata) { - FileRelationship fileRelationship = new FileRelationship() - .data( - new FileRelationshipData() - .id(fileId) - .type(FileRelationshipData.TypeEnum.FILE)); - return new CreatePartRequest() - .data( - new CreatePartRequestData() - .type("part") - .attributes( - new CreatePartRequestDataAttributes() - .suppliedId("my-part-" + UUID.randomUUID()) - .suppliedRevisionId("my-part-rev-A") - .name(partName) - .metadata(metadata)) - .relationships(new CreatePartRequestDataRelationships() - .source(new AnyOfFileRelationshipPartAssemblyRelationship(fileRelationship) - ))); - } - - private static CreatePartRequest createPartAssemblyRequest(List revisionIds, String assemblyName) { - - PartAssemblyRelationship partAssemblyRelationship = new PartAssemblyRelationship() - .data(new PartAssemblyRelationshipData() - .metadata(Collections.emptyMap()) - .children(createPartRevisionInstances(revisionIds)) - ); - var uuid = UUID.randomUUID(); - return new CreatePartRequest() - .data( - new CreatePartRequestData() - .type("assembly") - .attributes(new CreatePartRequestDataAttributes() - .suppliedId("my-assembly-" + uuid) - .suppliedRevisionId("my-part-rev-" + uuid) - .name(assemblyName)) - .relationships(new CreatePartRequestDataRelationships() - .source(new AnyOfFileRelationshipPartAssemblyRelationship(partAssemblyRelationship)) - )); - } - - private static List createPartRevisionInstances(List ids) { - int num = ids.size(); - return IntStream.range(0, num) - .mapToObj(ordinal -> new PartRevisionInstance(). - ordinal(ordinal) - .revisionId(ids.get(ordinal)) - .transform(new Matrix4() - .r0(createVector4(BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE)) - .r1(createVector4(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ONE)) - .r2(createVector4(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ONE)) - .r3(createVector4(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE)) - )) - .collect(Collectors.toList()); - } - - private static Vector4 createVector4(BigDecimal x, BigDecimal y, BigDecimal z, BigDecimal w) { - return new Vector4() - .x(x) - .y(y) - .z(z) - .w(w); - } -} diff --git a/src/main/java/com/vertexvis/example/SceneCreator.java b/src/main/java/com/vertexvis/example/SceneCreator.java deleted file mode 100644 index 7acb15b..0000000 --- a/src/main/java/com/vertexvis/example/SceneCreator.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.vertexvis.example; - -import static com.vertexvis.model.CameraFit.TypeEnum.FIT_VISIBLE_SCENE_ITEMS; - - -import com.vertexvis.ApiClient; -import com.vertexvis.api.SceneItemsApi; -import com.vertexvis.api.ScenesApi; -import com.vertexvis.model.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Optional; -import java.util.UUID; - -class SceneCreator { - private final ScenesApi scenes; - private final SceneItemsApi sceneItems; - - private static final Logger logger = LoggerFactory.getLogger(SceneCreator.class); - - public SceneCreator(ApiClient apiClient) { - this.scenes = new ScenesApi(apiClient); - this.sceneItems = new SceneItemsApi(apiClient); - } - - Scene commitSceneChanges(UUID sceneId) { - return scenes.updateScene( - sceneId, - new UpdateSceneRequest() - .data( - new UpdateSceneRequestData() - .type("scene") - .attributes( - new UpdateSceneRequestDataAttributes() - .state(UpdateSceneRequestDataAttributes.StateEnum.COMMIT) - .camera( - new AnyOfPerspectiveCameraOrthographicCameraCameraFit( - new CameraFit().type(FIT_VISIBLE_SCENE_ITEMS)))))); - } - - public Scene createSceneFromPart(Part p) throws InterruptedException { - return createSceneFromPart(p, true); - } - - public Scene createSceneFromPart(Part p, boolean commitChanges) throws InterruptedException { - assert p.getData().getRelationships() != null; - UUID revisionId = p.getData().getRelationships().getPartRevisions().get(0).getId(); - var name = Optional.of(p.getData().getAttributes()).map(PartDataAttributes::getName).orElse("ACube"); - Scene scene = - scenes.createScene( - new CreateSceneRequest() - .data( - new CreateSceneRequestData() - .type("scene") - .attributes(new CreateSceneRequestDataAttributes().name(name).treeEnabled(true)))); - - QueuedJob job = - sceneItems.createSceneItem( - scene.getData().getId(), - new CreateSceneItemRequest() - .data( - new CreateSceneItemRequestData() - .type("scene-item") - .attributes( - new CreateSceneItemRequestDataAttributes().suppliedId("my-part")) - .relationships( - new CreateSceneItemRequestDataRelationships() - .source( - new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - new PartRevisionRelationship() - .data( - new PartDataRelationshipsPartRevisions() - .type( - PartDataRelationshipsPartRevisions.TypeEnum - .PART_REVISION) - .id(revisionId))))))); - - JobPoller.pollUntilJobDone( - "scene-item", () -> sceneItems.getQueuedSceneItem(job.getData().getId())); - - - return commitChanges ? commitSceneChanges(scene.getData().getId()) : scene; - } -} diff --git a/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java b/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java deleted file mode 100644 index 38da3bf..0000000 --- a/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.vertexvis.example.cmdline; - -import picocli.CommandLine; - -import java.util.List; -import java.util.UUID; - -@CommandLine.Command(mixinStandardHelpOptions = true) -public abstract class CommandLineOptions implements Runnable { - @CommandLine.Spec - CommandLine.Model.CommandSpec spec; - - public List getPartFiles() { - return partFiles; - } - - public String getAssemblyName() { - return assemblyName; - } - - public String getClientId() { - return clientId; - } - - public String getClientSecret() { - return clientSecret; - } - - public String getVertexApiUrl() { - return vertexApiUrl; - } - - public boolean isVerboseDebugLogging() { - return verboseDebugLogging; - } - - public CommandLine.Model.CommandSpec getSpec() { - return spec; - } - - public int getMetadataCount() { - return metadataCount; - } - - @CommandLine.Parameters(arity = "1..*", description = "Specify CAD files separated by '${sys:path.separator}'" + - " to create part revisions from.", - split = "${sys:path.separator}") - private List partFiles; - @CommandLine.Option(names = {"-n"}, description = "Name of the assembly to create from the parts") - private String assemblyName = "assembly-from-parts" + UUID.randomUUID().toString(); - - @CommandLine.Option(names = {"-i", "--clientId"}, description = "Vertex API client id", defaultValue = "${env:VERTEX_CLIENT_ID}") - private String clientId; - @CommandLine.Option(names = {"-s", "--clientSecret"}, description = "Vertex API client secret", defaultValue = "${env:VERTEX_CLIENT_SECRET}") - private String clientSecret; - - @CommandLine.Option(names = {"-e", "--env"}, description = "Vertex API endpoint. Defaults to https://platform.vertexvis.com") - private String vertexApiUrl = "https://platform.vertexvis.com"; - - @CommandLine.Option(names = {"-v", "--verbose"}, description = "Turn on debug logging") - private boolean verboseDebugLogging; - - // parameter for number of metadata to create per part - @CommandLine.Option(names = {"-m", "--metadata"}, description = "Number of metadata to create") - private int metadataCount = 0; - - -} diff --git a/src/main/java/com/vertexvis/model/AbstractOpenApiSchema.java b/src/main/java/com/vertexvis/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000..37b99a1 --- /dev/null +++ b/src/main/java/com/vertexvis/model/AbstractOpenApiSchema.java @@ -0,0 +1,146 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import com.vertexvis.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/vertexvis/model/Account.java b/src/main/java/com/vertexvis/model/Account.java index ae53ddf..dceba27 100644 --- a/src/main/java/com/vertexvis/model/Account.java +++ b/src/main/java/com/vertexvis/model/Account.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AccountData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Account */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Account { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private AccountData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Account() { + public Account() { } - public Account data(AccountData data) { - + public Account data(@javax.annotation.Nonnull AccountData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AccountData getData() { return data; } - - public void setData(AccountData data) { + public void setData(@javax.annotation.Nonnull AccountData data) { this.data = data; } - public Account links(Map links) { - + public Account links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public Account putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Account + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Account.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Account is not found in the empty JSON string", Account.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Account.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Account` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Account.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Account.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Account' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Account.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Account value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Account read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Account given an JSON string + * + * @param jsonString JSON string + * @return An instance of Account + * @throws IOException if the JSON string is invalid with respect to Account + */ + public static Account fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Account.class); + } + + /** + * Convert an instance of Account to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AccountData.java b/src/main/java/com/vertexvis/model/AccountData.java index 01bb895..1760ec8 100644 --- a/src/main/java/com/vertexvis/model/AccountData.java +++ b/src/main/java/com/vertexvis/model/AccountData.java @@ -14,107 +14,120 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AccountDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * AccountData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AccountData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private AccountDataAttributes attributes; - public AccountData() { + public AccountData() { } - public AccountData type(String type) { - + public AccountData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "account", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public AccountData id(UUID id) { - + public AccountData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public AccountData attributes(AccountDataAttributes attributes) { - + public AccountData attributes(@javax.annotation.Nonnull AccountDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AccountDataAttributes getAttributes() { return attributes; } - - public void setAttributes(AccountDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull AccountDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountData is not found in the empty JSON string", AccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + AccountDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountData + * @throws IOException if the JSON string is invalid with respect to AccountData + */ + public static AccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountData.class); + } + + /** + * Convert an instance of AccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AccountDataAttributes.java b/src/main/java/com/vertexvis/model/AccountDataAttributes.java index 2aa1d14..c6910ac 100644 --- a/src/main/java/com/vertexvis/model/AccountDataAttributes.java +++ b/src/main/java/com/vertexvis/model/AccountDataAttributes.java @@ -14,106 +14,119 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AccountDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AccountDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; - public AccountDataAttributes() { + public AccountDataAttributes() { } - public AccountDataAttributes name(String name) { - + public AccountDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public AccountDataAttributes status(String status) { - + public AccountDataAttributes status(@javax.annotation.Nullable String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "active", value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nullable String status) { this.status = status; } - public AccountDataAttributes created(OffsetDateTime created) { - + public AccountDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } + @Override public boolean equals(Object o) { if (this == o) { @@ -155,5 +168,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("status"); + openapiFields.add("created"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountDataAttributes is not found in the empty JSON string", AccountDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountDataAttributes + * @throws IOException if the JSON string is invalid with respect to AccountDataAttributes + */ + public static AccountDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountDataAttributes.class); + } + + /** + * Convert an instance of AccountDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequest.java b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequest.java index 8fa0527..ed9aba7 100644 --- a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequest.java +++ b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminConsentAcceptRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminConsentAcceptRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminConsentAcceptRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private AdminConsentAcceptRequestData data; - public AdminConsentAcceptRequest() { + public AdminConsentAcceptRequest() { } - public AdminConsentAcceptRequest data(AdminConsentAcceptRequestData data) { - + public AdminConsentAcceptRequest data(@javax.annotation.Nonnull AdminConsentAcceptRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminConsentAcceptRequestData getData() { return data; } - - public void setData(AdminConsentAcceptRequestData data) { + public void setData(@javax.annotation.Nonnull AdminConsentAcceptRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminConsentAcceptRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminConsentAcceptRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminConsentAcceptRequest is not found in the empty JSON string", AdminConsentAcceptRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminConsentAcceptRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminConsentAcceptRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminConsentAcceptRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AdminConsentAcceptRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminConsentAcceptRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminConsentAcceptRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminConsentAcceptRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminConsentAcceptRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminConsentAcceptRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminConsentAcceptRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminConsentAcceptRequest + * @throws IOException if the JSON string is invalid with respect to AdminConsentAcceptRequest + */ + public static AdminConsentAcceptRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminConsentAcceptRequest.class); + } + + /** + * Convert an instance of AdminConsentAcceptRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestData.java b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestData.java index 34b0ed1..fc28fdc 100644 --- a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestData.java +++ b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminConsentAcceptRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminConsentAcceptRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminConsentAcceptRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private AdminConsentAcceptRequestDataAttributes attributes; - public AdminConsentAcceptRequestData() { + public AdminConsentAcceptRequestData() { } - public AdminConsentAcceptRequestData type(String type) { - + public AdminConsentAcceptRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public AdminConsentAcceptRequestData attributes(AdminConsentAcceptRequestDataAttributes attributes) { - + public AdminConsentAcceptRequestData attributes(@javax.annotation.Nonnull AdminConsentAcceptRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminConsentAcceptRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(AdminConsentAcceptRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull AdminConsentAcceptRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminConsentAcceptRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminConsentAcceptRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminConsentAcceptRequestData is not found in the empty JSON string", AdminConsentAcceptRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminConsentAcceptRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminConsentAcceptRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminConsentAcceptRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + AdminConsentAcceptRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminConsentAcceptRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminConsentAcceptRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminConsentAcceptRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminConsentAcceptRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminConsentAcceptRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminConsentAcceptRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminConsentAcceptRequestData + * @throws IOException if the JSON string is invalid with respect to AdminConsentAcceptRequestData + */ + public static AdminConsentAcceptRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminConsentAcceptRequestData.class); + } + + /** + * Convert an instance of AdminConsentAcceptRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestDataAttributes.java b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestDataAttributes.java index ab3e521..c3dab98 100644 --- a/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/AdminConsentAcceptRequestDataAttributes.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminConsentAcceptRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminConsentAcceptRequestDataAttributes { public static final String SERIALIZED_NAME_SESSION = "session"; @SerializedName(SERIALIZED_NAME_SESSION) + @javax.annotation.Nonnull private Object session; - public AdminConsentAcceptRequestDataAttributes() { + public AdminConsentAcceptRequestDataAttributes() { } - public AdminConsentAcceptRequestDataAttributes session(Object session) { - + public AdminConsentAcceptRequestDataAttributes session(@javax.annotation.Nonnull Object session) { this.session = session; return this; } - /** + /** * Get session * @return session - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Object getSession() { return session; } - - public void setSession(Object session) { + public void setSession(@javax.annotation.Nonnull Object session) { this.session = session; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,97 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("session"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("session"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminConsentAcceptRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminConsentAcceptRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminConsentAcceptRequestDataAttributes is not found in the empty JSON string", AdminConsentAcceptRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminConsentAcceptRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminConsentAcceptRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminConsentAcceptRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminConsentAcceptRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminConsentAcceptRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminConsentAcceptRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminConsentAcceptRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminConsentAcceptRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminConsentAcceptRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminConsentAcceptRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to AdminConsentAcceptRequestDataAttributes + */ + public static AdminConsentAcceptRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminConsentAcceptRequestDataAttributes.class); + } + + /** + * Convert an instance of AdminConsentAcceptRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequest.java b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequest.java index 2944e52..92fbf16 100644 --- a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequest.java +++ b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminCreateApplicationRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminCreateApplicationRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminCreateApplicationRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private AdminCreateApplicationRequestData data; - public AdminCreateApplicationRequest() { + public AdminCreateApplicationRequest() { } - public AdminCreateApplicationRequest data(AdminCreateApplicationRequestData data) { - + public AdminCreateApplicationRequest data(@javax.annotation.Nonnull AdminCreateApplicationRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminCreateApplicationRequestData getData() { return data; } - - public void setData(AdminCreateApplicationRequestData data) { + public void setData(@javax.annotation.Nonnull AdminCreateApplicationRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminCreateApplicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminCreateApplicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminCreateApplicationRequest is not found in the empty JSON string", AdminCreateApplicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminCreateApplicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminCreateApplicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminCreateApplicationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AdminCreateApplicationRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminCreateApplicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminCreateApplicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminCreateApplicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminCreateApplicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminCreateApplicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminCreateApplicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminCreateApplicationRequest + * @throws IOException if the JSON string is invalid with respect to AdminCreateApplicationRequest + */ + public static AdminCreateApplicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminCreateApplicationRequest.class); + } + + /** + * Convert an instance of AdminCreateApplicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestData.java b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestData.java index 061ed8a..7e05174 100644 --- a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestData.java +++ b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminCreateApplicationRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminCreateApplicationRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminCreateApplicationRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private AdminCreateApplicationRequestDataAttributes attributes; - public AdminCreateApplicationRequestData() { + public AdminCreateApplicationRequestData() { } - public AdminCreateApplicationRequestData type(String type) { - + public AdminCreateApplicationRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public AdminCreateApplicationRequestData attributes(AdminCreateApplicationRequestDataAttributes attributes) { - + public AdminCreateApplicationRequestData attributes(@javax.annotation.Nonnull AdminCreateApplicationRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminCreateApplicationRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(AdminCreateApplicationRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull AdminCreateApplicationRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminCreateApplicationRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminCreateApplicationRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminCreateApplicationRequestData is not found in the empty JSON string", AdminCreateApplicationRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminCreateApplicationRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminCreateApplicationRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminCreateApplicationRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + AdminCreateApplicationRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminCreateApplicationRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminCreateApplicationRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminCreateApplicationRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminCreateApplicationRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminCreateApplicationRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminCreateApplicationRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminCreateApplicationRequestData + * @throws IOException if the JSON string is invalid with respect to AdminCreateApplicationRequestData + */ + public static AdminCreateApplicationRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminCreateApplicationRequestData.class); + } + + /** + * Convert an instance of AdminCreateApplicationRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestDataAttributes.java b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestDataAttributes.java index 38079d8..9422537 100644 --- a/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/AdminCreateApplicationRequestDataAttributes.java @@ -14,63 +14,82 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminCreateApplicationRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminCreateApplicationRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_SCOPES = "scopes"; @SerializedName(SERIALIZED_NAME_SCOPES) - private List scopes = null; + @javax.annotation.Nullable + private List scopes = new ArrayList<>(); public static final String SERIALIZED_NAME_REDIRECT_URIS = "redirect_uris"; @SerializedName(SERIALIZED_NAME_REDIRECT_URIS) - private List redirectUris = null; + @javax.annotation.Nullable + private List redirectUris = new ArrayList<>(); - public AdminCreateApplicationRequestDataAttributes() { + public AdminCreateApplicationRequestDataAttributes() { } - public AdminCreateApplicationRequestDataAttributes name(String name) { - + public AdminCreateApplicationRequestDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public AdminCreateApplicationRequestDataAttributes scopes(List scopes) { - + public AdminCreateApplicationRequestDataAttributes scopes(@javax.annotation.Nullable List scopes) { this.scopes = scopes; return this; } @@ -83,25 +102,21 @@ public AdminCreateApplicationRequestDataAttributes addScopesItem(String scopesIt return this; } - /** + /** * Get scopes * @return scopes - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getScopes() { return scopes; } - - public void setScopes(List scopes) { + public void setScopes(@javax.annotation.Nullable List scopes) { this.scopes = scopes; } - public AdminCreateApplicationRequestDataAttributes redirectUris(List redirectUris) { - + public AdminCreateApplicationRequestDataAttributes redirectUris(@javax.annotation.Nullable List redirectUris) { this.redirectUris = redirectUris; return this; } @@ -114,23 +129,21 @@ public AdminCreateApplicationRequestDataAttributes addRedirectUrisItem(String re return this; } - /** + /** * Get redirectUris * @return redirectUris - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getRedirectUris() { return redirectUris; } - - public void setRedirectUris(List redirectUris) { + public void setRedirectUris(@javax.annotation.Nullable List redirectUris) { this.redirectUris = redirectUris; } + @Override public boolean equals(Object o) { if (this == o) { @@ -172,5 +185,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("scopes"); + openapiFields.add("redirect_uris"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminCreateApplicationRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminCreateApplicationRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminCreateApplicationRequestDataAttributes is not found in the empty JSON string", AdminCreateApplicationRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminCreateApplicationRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminCreateApplicationRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminCreateApplicationRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("scopes") != null && !jsonObj.get("scopes").isJsonNull() && !jsonObj.get("scopes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scopes` to be an array in the JSON string but got `%s`", jsonObj.get("scopes").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("redirect_uris") != null && !jsonObj.get("redirect_uris").isJsonNull() && !jsonObj.get("redirect_uris").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `redirect_uris` to be an array in the JSON string but got `%s`", jsonObj.get("redirect_uris").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminCreateApplicationRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminCreateApplicationRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminCreateApplicationRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminCreateApplicationRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminCreateApplicationRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminCreateApplicationRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminCreateApplicationRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to AdminCreateApplicationRequestDataAttributes + */ + public static AdminCreateApplicationRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminCreateApplicationRequestDataAttributes.class); + } + + /** + * Convert an instance of AdminCreateApplicationRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequest.java b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequest.java index db8f506..8728995 100644 --- a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequest.java +++ b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminLoginAcceptRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminLoginAcceptRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminLoginAcceptRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private AdminLoginAcceptRequestData data; - public AdminLoginAcceptRequest() { + public AdminLoginAcceptRequest() { } - public AdminLoginAcceptRequest data(AdminLoginAcceptRequestData data) { - + public AdminLoginAcceptRequest data(@javax.annotation.Nonnull AdminLoginAcceptRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminLoginAcceptRequestData getData() { return data; } - - public void setData(AdminLoginAcceptRequestData data) { + public void setData(@javax.annotation.Nonnull AdminLoginAcceptRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminLoginAcceptRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminLoginAcceptRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminLoginAcceptRequest is not found in the empty JSON string", AdminLoginAcceptRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminLoginAcceptRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminLoginAcceptRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminLoginAcceptRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AdminLoginAcceptRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminLoginAcceptRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminLoginAcceptRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminLoginAcceptRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminLoginAcceptRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminLoginAcceptRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminLoginAcceptRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminLoginAcceptRequest + * @throws IOException if the JSON string is invalid with respect to AdminLoginAcceptRequest + */ + public static AdminLoginAcceptRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminLoginAcceptRequest.class); + } + + /** + * Convert an instance of AdminLoginAcceptRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestData.java b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestData.java index 46c8149..ac57244 100644 --- a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestData.java +++ b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.AdminLoginAcceptRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminLoginAcceptRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminLoginAcceptRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private AdminLoginAcceptRequestDataAttributes attributes; - public AdminLoginAcceptRequestData() { + public AdminLoginAcceptRequestData() { } - public AdminLoginAcceptRequestData type(String type) { - + public AdminLoginAcceptRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public AdminLoginAcceptRequestData attributes(AdminLoginAcceptRequestDataAttributes attributes) { - + public AdminLoginAcceptRequestData attributes(@javax.annotation.Nonnull AdminLoginAcceptRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public AdminLoginAcceptRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(AdminLoginAcceptRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull AdminLoginAcceptRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminLoginAcceptRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminLoginAcceptRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminLoginAcceptRequestData is not found in the empty JSON string", AdminLoginAcceptRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminLoginAcceptRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminLoginAcceptRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminLoginAcceptRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + AdminLoginAcceptRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminLoginAcceptRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminLoginAcceptRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminLoginAcceptRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminLoginAcceptRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminLoginAcceptRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminLoginAcceptRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminLoginAcceptRequestData + * @throws IOException if the JSON string is invalid with respect to AdminLoginAcceptRequestData + */ + public static AdminLoginAcceptRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminLoginAcceptRequestData.class); + } + + /** + * Convert an instance of AdminLoginAcceptRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestDataAttributes.java b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestDataAttributes.java index 0876f46..bbcb8aa 100644 --- a/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/AdminLoginAcceptRequestDataAttributes.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminLoginAcceptRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminLoginAcceptRequestDataAttributes { public static final String SERIALIZED_NAME_SUBJECT = "subject"; @SerializedName(SERIALIZED_NAME_SUBJECT) + @javax.annotation.Nonnull private String subject; - public AdminLoginAcceptRequestDataAttributes() { + public AdminLoginAcceptRequestDataAttributes() { } - public AdminLoginAcceptRequestDataAttributes subject(String subject) { - + public AdminLoginAcceptRequestDataAttributes subject(@javax.annotation.Nonnull String subject) { this.subject = subject; return this; } - /** + /** * Get subject * @return subject - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getSubject() { return subject; } - - public void setSubject(String subject) { + public void setSubject(@javax.annotation.Nonnull String subject) { this.subject = subject; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("subject"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminLoginAcceptRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminLoginAcceptRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminLoginAcceptRequestDataAttributes is not found in the empty JSON string", AdminLoginAcceptRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminLoginAcceptRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminLoginAcceptRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminLoginAcceptRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("subject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `subject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminLoginAcceptRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminLoginAcceptRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminLoginAcceptRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminLoginAcceptRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminLoginAcceptRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminLoginAcceptRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminLoginAcceptRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to AdminLoginAcceptRequestDataAttributes + */ + public static AdminLoginAcceptRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminLoginAcceptRequestDataAttributes.class); + } + + /** + * Convert an instance of AdminLoginAcceptRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AdminRedirectTo.java b/src/main/java/com/vertexvis/model/AdminRedirectTo.java index 69ae621..272196f 100644 --- a/src/main/java/com/vertexvis/model/AdminRedirectTo.java +++ b/src/main/java/com/vertexvis/model/AdminRedirectTo.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * AdminRedirectTo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class AdminRedirectTo { public static final String SERIALIZED_NAME_REDIRECT_TO = "redirectTo"; @SerializedName(SERIALIZED_NAME_REDIRECT_TO) + @javax.annotation.Nonnull private String redirectTo; - public AdminRedirectTo() { + public AdminRedirectTo() { } - public AdminRedirectTo redirectTo(String redirectTo) { - + public AdminRedirectTo redirectTo(@javax.annotation.Nonnull String redirectTo) { this.redirectTo = redirectTo; return this; } - /** + /** * Get redirectTo * @return redirectTo - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getRedirectTo() { return redirectTo; } - - public void setRedirectTo(String redirectTo) { + public void setRedirectTo(@javax.annotation.Nonnull String redirectTo) { this.redirectTo = redirectTo; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("redirectTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("redirectTo"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdminRedirectTo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdminRedirectTo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminRedirectTo is not found in the empty JSON string", AdminRedirectTo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdminRedirectTo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdminRedirectTo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminRedirectTo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("redirectTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminRedirectTo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminRedirectTo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminRedirectTo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminRedirectTo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdminRedirectTo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminRedirectTo given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminRedirectTo + * @throws IOException if the JSON string is invalid with respect to AdminRedirectTo + */ + public static AdminRedirectTo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminRedirectTo.class); + } + + /** + * Convert an instance of AdminRedirectTo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/AnyOfCameraCameraFit.java b/src/main/java/com/vertexvis/model/AnyOfCameraCameraFit.java deleted file mode 100644 index 62e8dbe..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfCameraCameraFit.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfCameraCameraFit { - private OneOfPerspectiveCameraOrthographicCamera camera; - private CameraFit cameraFit; - - public AnyOfCameraCameraFit(OneOfPerspectiveCameraOrthographicCamera camera) { - this.camera = camera; - } - - public AnyOfCameraCameraFit(CameraFit cameraFit) { - this.cameraFit = cameraFit; - } - - public Object getCam() { - if (this.camera != null) { - return this.camera; - } - if (this.cameraFit != null) { - return this.cameraFit; - } - - return null; - } - - @Nullable - public OneOfPerspectiveCameraOrthographicCamera getCamera() { - return this.camera; - } - - @Nullable - public CameraFit getCameraFit() { - return this.cameraFit; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.java b/src/main/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.java deleted file mode 100644 index 7184891..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp { - private ChangeVisibilityOp changeVisibilityOperation; - private ChangeMaterialOp changeMaterialOperation; - private ClearMaterialOp clearMaterialOperation; - private ChangeTransformOp changeTransformOperation; - private ClearTransformOp clearTransformOperation; - private SelectOp selectOperation; - private DeselectOperation deselectOperation; - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - ChangeVisibilityOp changeVisibilityOperation) { - this.changeVisibilityOperation = changeVisibilityOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - ChangeMaterialOp changeMaterialOperation) { - this.changeMaterialOperation = changeMaterialOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - ClearMaterialOp clearMaterialOperation) { - this.clearMaterialOperation = clearMaterialOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - ChangeTransformOp changeTransformOperation) { - this.changeTransformOperation = changeTransformOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - ClearTransformOp clearTransformOperation) { - this.clearTransformOperation = clearTransformOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - SelectOp selectOperation) { - this.selectOperation = selectOperation; - } - - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp( - DeselectOperation deselectOperation) { - this.deselectOperation = deselectOperation; - } - - public Object getOperation() { - if (this.changeVisibilityOperation != null) { - return this.changeVisibilityOperation; - } - if (this.changeMaterialOperation != null) { - return this.changeMaterialOperation; - } - if (this.clearMaterialOperation != null) { - return this.clearMaterialOperation; - } - if (this.changeTransformOperation != null) { - return this.changeTransformOperation; - } - if (this.clearTransformOperation != null) { - return this.clearTransformOperation; - } - if (this.selectOperation != null) { - return this.selectOperation; - } - if (this.deselectOperation != null) { - return this.deselectOperation; - } - - return null; - } - - @Nullable - public ChangeVisibilityOp getChangeVisibilityOperation() { - return this.changeVisibilityOperation; - } - - @Nullable - public ChangeMaterialOp getChangeMaterialOperation() { - return this.changeMaterialOperation; - } - - @Nullable - public ClearMaterialOp getClearMaterialOperation() { - return this.clearMaterialOperation; - } - - @Nullable - public ChangeTransformOp getChangeTransformOperation() { - return this.changeTransformOperation; - } - - @Nullable - public ClearTransformOp getClearTransformOperation() { - return this.clearTransformOperation; - } - - @Nullable - public SelectOp getSelectOperation() { - return this.selectOperation; - } - - @Nullable - public DeselectOperation getDeselectOperation() { - return this.deselectOperation; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfCreateSceneItemRequestData.java b/src/main/java/com/vertexvis/model/AnyOfCreateSceneItemRequestData.java deleted file mode 100644 index d707eaa..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfCreateSceneItemRequestData.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfCreateSceneItemRequestData { - private final CreateSceneItemRequestData createSceneItemRequestData; - - public AnyOfCreateSceneItemRequestData(CreateSceneItemRequestData createSceneItemRequestData) { - this.createSceneItemRequestData = createSceneItemRequestData; - } - - public Object getObj() { - return this.createSceneItemRequestData; - } - - @Nullable - public CreateSceneItemRequestData getCreateSceneItemRequestData() { - return this.createSceneItemRequestData; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationship.java b/src/main/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationship.java deleted file mode 100644 index ff7e2ba..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfFileRelationshipPartAssemblyRelationship.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vertexvis.model; - -import java.util.Objects; - -public class AnyOfFileRelationshipPartAssemblyRelationship { - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AnyOfFileRelationshipPartAssemblyRelationship that = (AnyOfFileRelationshipPartAssemblyRelationship) o; - return Objects.equals(fileRelationship, that.fileRelationship) && Objects.equals(partAssemblyRelationship, that.partAssemblyRelationship); - } - - @Override - public int hashCode() { - return Objects.hash(fileRelationship, partAssemblyRelationship); - } - - private FileRelationship fileRelationship; - private PartAssemblyRelationship partAssemblyRelationship; - - public AnyOfFileRelationshipPartAssemblyRelationship(FileRelationship rel){ - this.fileRelationship = rel; - } - - public AnyOfFileRelationshipPartAssemblyRelationship(PartAssemblyRelationship rel){ - this.partAssemblyRelationship = rel; - } - public FileRelationship getFileRelationship() { - return fileRelationship; - } - - public PartAssemblyRelationship getPartAssemblyRelationship() { - return partAssemblyRelationship; - } - -} diff --git a/src/main/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionData.java b/src/main/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionData.java deleted file mode 100644 index 34b77f6..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfGeometrySetDataPartRevisionDataPartRenditionData.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.vertexvis.model; - -public class AnyOfGeometrySetDataPartRevisionDataPartRenditionData { - private Object value = null; - - public AnyOfGeometrySetDataPartRevisionDataPartRenditionData() { - } - - public AnyOfGeometrySetDataPartRevisionDataPartRenditionData(GeometrySetData value) { - this.value = value; - } - - public AnyOfGeometrySetDataPartRevisionDataPartRenditionData(PartRevisionData value) { - this.value = value; - } - - public AnyOfGeometrySetDataPartRevisionDataPartRenditionData(PartRenditionData value) { - this.value = value; - } - - public Object getRel() { - return value; - } - - public boolean isGeometrySetData() { - return value != null && value instanceof GeometrySetData; - } - - public boolean isPartRevisionData() { - return value != null && value instanceof PartRevisionData; - } - - public boolean isPartRenditionData() { - return value != null && value instanceof PartRenditionData; - } - - public GeometrySetData getGeometrySetData() { - return isGeometrySetData() ? (GeometrySetData) value : null; - } - - public PartRevisionData getPartRevisionData() { - return isPartRevisionData() ? (PartRevisionData) value : null; - } - - public PartRenditionData getPartRenditionData() { - return isPartRenditionData() ? (PartRenditionData) value : null; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationship.java b/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationship.java deleted file mode 100644 index 4c866cf..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationship.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.vertexvis.model; - -public class AnyOfGeometrySetRelationshipPartRevisionRelationship { - private GeometrySetRelationship gsRel = null; - private PartRevisionRelationship prRel = null; - - public AnyOfGeometrySetRelationshipPartRevisionRelationship(GeometrySetRelationship gsRel) { - this.gsRel = gsRel; - } - - public AnyOfGeometrySetRelationshipPartRevisionRelationship(PartRevisionRelationship prRel) { - this.prRel = prRel; - } - - public Object getRel() { - if (this.gsRel != null) { - return this.gsRel; - } - if (this.prRel != null) { - return this.prRel; - } - - return null; - } - - public boolean isGeometrySetRel() { - return this.gsRel != null; - } - - public boolean isPartRevisionRel() { - return this.prRel != null; - } - - public GeometrySetRelationship getGeometrySetRel() { - return gsRel; - } - - public PartRevisionRelationship getPartRevisionRel() { - return prRel; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.java b/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.java deleted file mode 100644 index 98de3b7..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.vertexvis.model; - -public class AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship { - private GeometrySetRelationship gsRel = null; - private PartRevisionRelationship prRel = null; - private SceneRelationship sRel = null; - private PartRenditionRelationship partRenRel = null; - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - GeometrySetRelationship gsRel) { - this.gsRel = gsRel; - } - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - PartRevisionRelationship prRel) { - this.prRel = prRel; - } - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - SceneRelationship sRel) { - this.sRel = sRel; - } - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - PartRenditionRelationship partRenRel) { - this.partRenRel = partRenRel; - } - - public Object getRel() { - if (this.gsRel != null) { - return this.gsRel; - } - if (this.prRel != null) { - return this.prRel; - } - if (this.sRel != null) { - return this.sRel; - } - if (this.partRenRel != null) { - return this.partRenRel; - } - - return null; - } - - public boolean isGeometrySetRel() { - return this.gsRel != null; - } - - public boolean isPartRevisionRel() { - return this.prRel != null; - } - - public boolean isSceneRel() { - return this.sRel != null; - } - - public GeometrySetRelationship getGeometrySetRel() { - return gsRel; - } - - public PartRevisionRelationship getPartRevisionRel() { - return prRel; - } - - public SceneRelationship getSceneRel() { - return sRel; - } - - public PartRenditionRelationship getPartRenditionRel() { - return partRenRel; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.java b/src/main/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.java deleted file mode 100644 index 742d53e..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType { - private Object value = null; - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType() { - } - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - MetadataLongType value) { - this.value = value; - } - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - MetadataFloatType value) { - this.value = value; - } - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - MetadataDateType value) { - this.value = value; - } - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - MetadataStringType value) { - this.value = value; - } - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - MetadataNullType value) { - this.value = value; - } - - public Object getValue() { - return value; - } - - public boolean isMetadataLongType() { - return this.value != null && this.value instanceof MetadataLongType; - } - - public boolean isMetadataFloatType() { - return this.value != null && this.value instanceof MetadataFloatType; - } - - public boolean isMetadataDateType() { - return this.value != null && this.value instanceof MetadataDateType; - } - - public boolean isMetadataStringType() { - return this.value != null && this.value instanceof MetadataStringType; - } - - public boolean isMetadataNullType() { - return this.value != null && this.value instanceof MetadataNullType; - } - - @Nullable - public MetadataLongType getMetadataLongType() { - return isMetadataLongType() ? (MetadataLongType) this.value : null; - } - - @Nullable - public MetadataFloatType getMetadataFloatType() { - return isMetadataFloatType() ? (MetadataFloatType) this.value : null; - } - - @Nullable - public MetadataDateType getMetadataDateType() { - return isMetadataDateType() ? (MetadataDateType) this.value : null; - } - - @Nullable - public MetadataStringType getMetadataStringType() { - return isMetadataStringType() ? (MetadataStringType) this.value : null; - } - - @Nullable - public MetadataNullType getMetadataNullType() { - return isMetadataNullType() ? (MetadataNullType) this.value : null; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraCameraFit.java b/src/main/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraCameraFit.java deleted file mode 100644 index d2100cd..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraCameraFit.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfPerspectiveCameraOrthographicCameraCameraFit { - private PerspectiveCamera perspectiveCamera; - private OrthographicCamera orthographicCamera; - private CameraFit cameraFit; - - public AnyOfPerspectiveCameraOrthographicCameraCameraFit(PerspectiveCamera perspectiveCamera) { - this.perspectiveCamera = perspectiveCamera; - } - - public AnyOfPerspectiveCameraOrthographicCameraCameraFit(OrthographicCamera orthographicCamera) { - this.orthographicCamera = orthographicCamera; - } - - public AnyOfPerspectiveCameraOrthographicCameraCameraFit(CameraFit cameraFit) { - this.cameraFit = cameraFit; - } - - public Object getAnyOfCameraFit() { - if (orthographicCamera != null) { - return this.orthographicCamera; - } - if (perspectiveCamera != null) { - return this.perspectiveCamera; - } - - if (this.cameraFit != null) { - return this.cameraFit; - } - - return null; - } - - @Nullable - public PerspectiveCamera getPerspectiveCamera() { - return this.perspectiveCamera; - } - - @Nullable - public OrthographicCamera getOrthographicCamera() { - return this.orthographicCamera; - } - - @Nullable - public CameraFit getCameraFit() { - return this.cameraFit; - } -} - diff --git a/src/main/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAll.java b/src/main/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAll.java deleted file mode 100644 index e5d7b62..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfQueryByIdQueryByCollectionQueryAll.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfQueryByIdQueryByCollectionQueryAll { - private QueryById queryById; - private QueryByCollection queryByCollection; - private QueryAll queryAll; - - public AnyOfQueryByIdQueryByCollectionQueryAll(QueryById queryById) { - this.queryById = queryById; - } - - public AnyOfQueryByIdQueryByCollectionQueryAll(QueryByCollection queryByCollection) { - this.queryByCollection = queryByCollection; - } - - public AnyOfQueryByIdQueryByCollectionQueryAll(QueryAll queryAll) { - this.queryAll = queryAll; - } - - public Object getQuery() { - if (queryById != null) { - return this.queryById; - } - if (queryByCollection != null) { - return this.queryByCollection; - } - if (queryAll != null) { - return this.queryAll; - } - - return null; - } - - @Nullable - public QueryById getQueryById() { - return this.queryById; - } - - @Nullable - public QueryByCollection getQueryByCollection() { - return this.queryByCollection; - } - - @Nullable - public QueryAll getQueryAll() { - return this.queryAll; - } -} diff --git a/src/main/java/com/vertexvis/model/AnyOfRelationshipDataApiError.java b/src/main/java/com/vertexvis/model/AnyOfRelationshipDataApiError.java deleted file mode 100644 index a98c3d3..0000000 --- a/src/main/java/com/vertexvis/model/AnyOfRelationshipDataApiError.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class AnyOfRelationshipDataApiError { - private RelationshipData relationshipData; - private ApiError apiError; - - public AnyOfRelationshipDataApiError(RelationshipData relationshipData) { - this.relationshipData = relationshipData; - } - - public AnyOfRelationshipDataApiError(ApiError apiError) { - this.apiError = apiError; - } - - public Object getObj() { - if (this.relationshipData != null) { - return this.relationshipData; - } - if (this.apiError != null) { - return this.apiError; - } - - return null; - } - - @Nullable - public RelationshipData getRelationshipData() { - return this.relationshipData; - } - - @Nullable - public ApiError getApiError() { - return this.apiError; - } -} diff --git a/src/main/java/com/vertexvis/model/ApiError.java b/src/main/java/com/vertexvis/model/ApiError.java index be4d50b..ad61f9a 100644 --- a/src/main/java/com/vertexvis/model/ApiError.java +++ b/src/main/java/com/vertexvis/model/ApiError.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,78 +21,102 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApiErrorSource; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * ApiError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApiError { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable private String code; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable private String title; public static final String SERIALIZED_NAME_DETAIL = "detail"; @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nullable private String detail; public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private ApiErrorSource source; public static final String SERIALIZED_NAME_META = "meta"; @SerializedName(SERIALIZED_NAME_META) - private Map meta = null; + @javax.annotation.Nullable + private Map meta = new HashMap<>(); - public ApiError() { + public ApiError() { } - public ApiError id(String id) { - + public ApiError id(@javax.annotation.Nullable String id) { this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "7c46d4c3-e065-4eae-87ec-08233cf8743b", value = "") - public String getId() { return id; } - - public void setId(String id) { + public void setId(@javax.annotation.Nullable String id) { this.id = id; } - public ApiError links(Map links) { - + public ApiError links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -106,140 +129,116 @@ public ApiError putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } - public ApiError status(String status) { - + public ApiError status(@javax.annotation.Nullable String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "400", value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nullable String status) { this.status = status; } - public ApiError code(String code) { - + public ApiError code(@javax.annotation.Nullable String code) { this.code = code; return this; } - /** + /** * Get code * @return code - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "ValidationError", value = "") - public String getCode() { return code; } - - public void setCode(String code) { + public void setCode(@javax.annotation.Nullable String code) { this.code = code; } - public ApiError title(String title) { - + public ApiError title(@javax.annotation.Nullable String title) { this.title = title; return this; } - /** + /** * Get title * @return title - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "A validation error occurred.", value = "") - public String getTitle() { return title; } - - public void setTitle(String title) { + public void setTitle(@javax.annotation.Nullable String title) { this.title = title; } - public ApiError detail(String detail) { - + public ApiError detail(@javax.annotation.Nullable String detail) { this.detail = detail; return this; } - /** + /** * Get detail * @return detail - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "$.data.attributes.suppliedId: is missing but it is required", value = "") - public String getDetail() { return detail; } - - public void setDetail(String detail) { + public void setDetail(@javax.annotation.Nullable String detail) { this.detail = detail; } - public ApiError source(ApiErrorSource source) { - + public ApiError source(@javax.annotation.Nullable ApiErrorSource source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ApiErrorSource getSource() { return source; } - - public void setSource(ApiErrorSource source) { + public void setSource(@javax.annotation.Nullable ApiErrorSource source) { this.source = source; } - public ApiError meta(Map meta) { - + public ApiError meta(@javax.annotation.Nullable Map meta) { this.meta = meta; return this; } @@ -252,23 +251,21 @@ public ApiError putMetaItem(String key, String metaItem) { return this; } - /** + /** * Get meta * @return meta - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getMeta() { return meta; } - - public void setMeta(Map meta) { + public void setMeta(@javax.annotation.Nullable Map meta) { this.meta = meta; } + @Override public boolean equals(Object o) { if (this == o) { @@ -320,5 +317,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("links"); + openapiFields.add("status"); + openapiFields.add("code"); + openapiFields.add("title"); + openapiFields.add("detail"); + openapiFields.add("source"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApiError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApiError is not found in the empty JSON string", ApiError.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApiError.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApiError` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) && !jsonObj.get("detail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `detail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detail").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + ApiErrorSource.validateJsonElement(jsonObj.get("source")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApiError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApiError given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiError + * @throws IOException if the JSON string is invalid with respect to ApiError + */ + public static ApiError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiError.class); + } + + /** + * Convert an instance of ApiError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ApiErrorSource.java b/src/main/java/com/vertexvis/model/ApiErrorSource.java index 0e63bfd..7401675 100644 --- a/src/main/java/com/vertexvis/model/ApiErrorSource.java +++ b/src/main/java/com/vertexvis/model/ApiErrorSource.java @@ -14,78 +14,94 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * ApiErrorSource */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApiErrorSource { public static final String SERIALIZED_NAME_POINTER = "pointer"; @SerializedName(SERIALIZED_NAME_POINTER) + @javax.annotation.Nullable private String pointer; public static final String SERIALIZED_NAME_PARAMETER = "parameter"; @SerializedName(SERIALIZED_NAME_PARAMETER) + @javax.annotation.Nullable private String parameter; - public ApiErrorSource() { + public ApiErrorSource() { } - public ApiErrorSource pointer(String pointer) { - + public ApiErrorSource pointer(@javax.annotation.Nullable String pointer) { this.pointer = pointer; return this; } - /** + /** * Get pointer * @return pointer - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "/body/data/attributes", value = "") - public String getPointer() { return pointer; } - - public void setPointer(String pointer) { + public void setPointer(@javax.annotation.Nullable String pointer) { this.pointer = pointer; } - public ApiErrorSource parameter(String parameter) { - + public ApiErrorSource parameter(@javax.annotation.Nullable String parameter) { this.parameter = parameter; return this; } - /** + /** * Get parameter * @return parameter - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "page[cursor]", value = "") - public String getParameter() { return parameter; } - - public void setParameter(String parameter) { + public void setParameter(@javax.annotation.Nullable String parameter) { this.parameter = parameter; } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,5 +141,96 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("pointer"); + openapiFields.add("parameter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApiErrorSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiErrorSource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApiErrorSource is not found in the empty JSON string", ApiErrorSource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApiErrorSource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApiErrorSource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("pointer") != null && !jsonObj.get("pointer").isJsonNull()) && !jsonObj.get("pointer").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pointer` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pointer").toString())); + } + if ((jsonObj.get("parameter") != null && !jsonObj.get("parameter").isJsonNull()) && !jsonObj.get("parameter").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parameter` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parameter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiErrorSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiErrorSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiErrorSource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiErrorSource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApiErrorSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApiErrorSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiErrorSource + * @throws IOException if the JSON string is invalid with respect to ApiErrorSource + */ + public static ApiErrorSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiErrorSource.class); + } + + /** + * Convert an instance of ApiErrorSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Application.java b/src/main/java/com/vertexvis/model/Application.java index 51b43fd..5a98ac2 100644 --- a/src/main/java/com/vertexvis/model/Application.java +++ b/src/main/java/com/vertexvis/model/Application.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApplicationData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Application */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Application { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private ApplicationData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Application() { + public Application() { } - public Application data(ApplicationData data) { - + public Application data(@javax.annotation.Nonnull ApplicationData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ApplicationData getData() { return data; } - - public void setData(ApplicationData data) { + public void setData(@javax.annotation.Nonnull ApplicationData data) { this.data = data; } - public Application links(Map links) { - + public Application links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public Application putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Application + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Application.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Application is not found in the empty JSON string", Application.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Application.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Application` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Application.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ApplicationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Application.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Application' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Application.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Application value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Application read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Application given an JSON string + * + * @param jsonString JSON string + * @return An instance of Application + * @throws IOException if the JSON string is invalid with respect to Application + */ + public static Application fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Application.class); + } + + /** + * Convert an instance of Application to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ApplicationData.java b/src/main/java/com/vertexvis/model/ApplicationData.java index af79208..927bac1 100644 --- a/src/main/java/com/vertexvis/model/ApplicationData.java +++ b/src/main/java/com/vertexvis/model/ApplicationData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApplicationDataAttributes; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ApplicationData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApplicationData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private ApplicationDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public ApplicationData() { + public ApplicationData() { } - public ApplicationData type(String type) { - + public ApplicationData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "application", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public ApplicationData id(UUID id) { - + public ApplicationData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public ApplicationData attributes(ApplicationDataAttributes attributes) { - + public ApplicationData attributes(@javax.annotation.Nonnull ApplicationDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ApplicationDataAttributes getAttributes() { return attributes; } - - public void setAttributes(ApplicationDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull ApplicationDataAttributes attributes) { this.attributes = attributes; } - public ApplicationData links(Map links) { - + public ApplicationData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public ApplicationData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationData is not found in the empty JSON string", ApplicationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + ApplicationDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationData + * @throws IOException if the JSON string is invalid with respect to ApplicationData + */ + public static ApplicationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationData.class); + } + + /** + * Convert an instance of ApplicationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ApplicationDataAttributes.java b/src/main/java/com/vertexvis/model/ApplicationDataAttributes.java index 2c6484b..a29fe90 100644 --- a/src/main/java/com/vertexvis/model/ApplicationDataAttributes.java +++ b/src/main/java/com/vertexvis/model/ApplicationDataAttributes.java @@ -14,172 +14,185 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * ApplicationDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApplicationDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_CLIENT_ID = "clientId"; @SerializedName(SERIALIZED_NAME_CLIENT_ID) + @javax.annotation.Nonnull private String clientId; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_SCOPES = "scopes"; @SerializedName(SERIALIZED_NAME_SCOPES) + @javax.annotation.Nonnull private List scopes = new ArrayList<>(); public static final String SERIALIZED_NAME_REDIRECT_URIS = "redirectUris"; @SerializedName(SERIALIZED_NAME_REDIRECT_URIS) + @javax.annotation.Nonnull private List redirectUris = new ArrayList<>(); - public ApplicationDataAttributes() { + public ApplicationDataAttributes() { } - public ApplicationDataAttributes name(String name) { - + public ApplicationDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public ApplicationDataAttributes clientId(String clientId) { - + public ApplicationDataAttributes clientId(@javax.annotation.Nonnull String clientId) { this.clientId = clientId; return this; } - /** + /** * Get clientId * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getClientId() { return clientId; } - - public void setClientId(String clientId) { + public void setClientId(@javax.annotation.Nonnull String clientId) { this.clientId = clientId; } - public ApplicationDataAttributes created(OffsetDateTime created) { - + public ApplicationDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public ApplicationDataAttributes scopes(List scopes) { - + public ApplicationDataAttributes scopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; return this; } public ApplicationDataAttributes addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } this.scopes.add(scopesItem); return this; } - /** + /** * Get scopes * @return scopes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getScopes() { return scopes; } - - public void setScopes(List scopes) { + public void setScopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; } - public ApplicationDataAttributes redirectUris(List redirectUris) { - + public ApplicationDataAttributes redirectUris(@javax.annotation.Nonnull List redirectUris) { this.redirectUris = redirectUris; return this; } public ApplicationDataAttributes addRedirectUrisItem(String redirectUrisItem) { + if (this.redirectUris == null) { + this.redirectUris = new ArrayList<>(); + } this.redirectUris.add(redirectUrisItem); return this; } - /** + /** * Get redirectUris * @return redirectUris - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getRedirectUris() { return redirectUris; } - - public void setRedirectUris(List redirectUris) { + public void setRedirectUris(@javax.annotation.Nonnull List redirectUris) { this.redirectUris = redirectUris; } + @Override public boolean equals(Object o) { if (this == o) { @@ -225,5 +238,123 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("clientId"); + openapiFields.add("created"); + openapiFields.add("scopes"); + openapiFields.add("redirectUris"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("clientId"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("scopes"); + openapiRequiredFields.add("redirectUris"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationDataAttributes is not found in the empty JSON string", ApplicationDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("clientId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("scopes") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("scopes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scopes` to be an array in the JSON string but got `%s`", jsonObj.get("scopes").toString())); + } + // ensure the required json array is present + if (jsonObj.get("redirectUris") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("redirectUris").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectUris` to be an array in the JSON string but got `%s`", jsonObj.get("redirectUris").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationDataAttributes + * @throws IOException if the JSON string is invalid with respect to ApplicationDataAttributes + */ + public static ApplicationDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationDataAttributes.class); + } + + /** + * Convert an instance of ApplicationDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ApplicationList.java b/src/main/java/com/vertexvis/model/ApplicationList.java index 586c061..486885a 100644 --- a/src/main/java/com/vertexvis/model/ApplicationList.java +++ b/src/main/java/com/vertexvis/model/ApplicationList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApplicationData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ApplicationList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ApplicationList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public ApplicationList() { + public ApplicationList() { } - public ApplicationList data(List data) { - + public ApplicationList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public ApplicationList addDataItem(ApplicationData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public ApplicationList links(Map links) { - + public ApplicationList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public ApplicationList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationList is not found in the empty JSON string", ApplicationList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ApplicationData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationList + * @throws IOException if the JSON string is invalid with respect to ApplicationList + */ + public static ApplicationList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationList.class); + } + + /** + * Convert an instance of ApplicationList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Batch.java b/src/main/java/com/vertexvis/model/Batch.java index 80f5919..435f56c 100644 --- a/src/main/java/com/vertexvis/model/Batch.java +++ b/src/main/java/com/vertexvis/model/Batch.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfRelationshipDataApiError; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.BatchVertexvisBatchResultsInner; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Batch */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Batch { - public static final String SERIALIZED_NAME_VERTEXVIS_BATCH_COLON_RESULTS = "vertexvis/batch:results"; - @SerializedName(SERIALIZED_NAME_VERTEXVIS_BATCH_COLON_RESULTS) - private List vertexvisBatchColonResults = new ArrayList<>(); + public static final String SERIALIZED_NAME_VERTEXVIS_BATCH_RESULTS = "vertexvis/batch:results"; + @SerializedName(SERIALIZED_NAME_VERTEXVIS_BATCH_RESULTS) + @javax.annotation.Nonnull + private List vertexvisBatchResults = new ArrayList<>(); - public Batch() { + public Batch() { } - public Batch vertexvisBatchColonResults(List vertexvisBatchColonResults) { - - this.vertexvisBatchColonResults = vertexvisBatchColonResults; + public Batch vertexvisBatchResults(@javax.annotation.Nonnull List vertexvisBatchResults) { + this.vertexvisBatchResults = vertexvisBatchResults; return this; } - public Batch addVertexvisBatchColonResultsItem(AnyOfRelationshipDataApiError vertexvisBatchColonResultsItem) { - this.vertexvisBatchColonResults.add(vertexvisBatchColonResultsItem); + public Batch addVertexvisBatchResultsItem(BatchVertexvisBatchResultsInner vertexvisBatchResultsItem) { + if (this.vertexvisBatchResults == null) { + this.vertexvisBatchResults = new ArrayList<>(); + } + this.vertexvisBatchResults.add(vertexvisBatchResultsItem); return this; } - /** + /** * List of operation results. - * @return vertexvisBatchColonResults - **/ + * @return vertexvisBatchResults + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "List of operation results.") - - public List getVertexvisBatchColonResults() { - return vertexvisBatchColonResults; + public List getVertexvisBatchResults() { + return vertexvisBatchResults; } - - public void setVertexvisBatchColonResults(List vertexvisBatchColonResults) { - this.vertexvisBatchColonResults = vertexvisBatchColonResults; + public void setVertexvisBatchResults(@javax.annotation.Nonnull List vertexvisBatchResults) { + this.vertexvisBatchResults = vertexvisBatchResults; } + @Override public boolean equals(Object o) { if (this == o) { @@ -76,19 +98,19 @@ public boolean equals(Object o) { return false; } Batch batch = (Batch) o; - return Objects.equals(this.vertexvisBatchColonResults, batch.vertexvisBatchColonResults); + return Objects.equals(this.vertexvisBatchResults, batch.vertexvisBatchResults); } @Override public int hashCode() { - return Objects.hash(vertexvisBatchColonResults); + return Objects.hash(vertexvisBatchResults); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Batch {\n"); - sb.append(" vertexvisBatchColonResults: ").append(toIndentedString(vertexvisBatchColonResults)).append("\n"); + sb.append(" vertexvisBatchResults: ").append(toIndentedString(vertexvisBatchResults)).append("\n"); sb.append("}"); return sb.toString(); } @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("vertexvis/batch:results"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("vertexvis/batch:results"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Batch + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Batch.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Batch is not found in the empty JSON string", Batch.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Batch.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Batch` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Batch.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("vertexvis/batch:results").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `vertexvis/batch:results` to be an array in the JSON string but got `%s`", jsonObj.get("vertexvis/batch:results").toString())); + } + + JsonArray jsonArrayvertexvisBatchResults = jsonObj.getAsJsonArray("vertexvis/batch:results"); + // validate the required field `vertexvis/batch:results` (array) + for (int i = 0; i < jsonArrayvertexvisBatchResults.size(); i++) { + BatchVertexvisBatchResultsInner.validateJsonElement(jsonArrayvertexvisBatchResults.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Batch.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Batch' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Batch.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Batch value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Batch read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Batch given an JSON string + * + * @param jsonString JSON string + * @return An instance of Batch + * @throws IOException if the JSON string is invalid with respect to Batch + */ + public static Batch fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Batch.class); + } + + /** + * Convert an instance of Batch to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/BatchOperation.java b/src/main/java/com/vertexvis/model/BatchOperation.java index fc39ec9..0598807 100644 --- a/src/main/java/com/vertexvis/model/BatchOperation.java +++ b/src/main/java/com/vertexvis/model/BatchOperation.java @@ -14,25 +14,48 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.BatchOperationRef; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.CreateSceneItemRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * BatchOperation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class BatchOperation { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) - private AnyOfCreateSceneItemRequestData data; + @javax.annotation.Nonnull + private CreateSceneItemRequestData data; /** * Batch operation type type. @@ -77,88 +100,84 @@ public OpEnum read(final JsonReader jsonReader) throws IOException { return OpEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OpEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_OP = "op"; @SerializedName(SERIALIZED_NAME_OP) + @javax.annotation.Nonnull private OpEnum op; public static final String SERIALIZED_NAME_REF = "ref"; @SerializedName(SERIALIZED_NAME_REF) + @javax.annotation.Nonnull private BatchOperationRef ref; - public BatchOperation() { + public BatchOperation() { } - public BatchOperation data(AnyOfCreateSceneItemRequestData data) { - + public BatchOperation data(@javax.annotation.Nonnull CreateSceneItemRequestData data) { this.data = data; return this; } - /** - * Operation's primary data. + /** + * Get data * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "Operation's primary data.") - - public AnyOfCreateSceneItemRequestData getData() { + */ + @javax.annotation.Nonnull + public CreateSceneItemRequestData getData() { return data; } - - public void setData(AnyOfCreateSceneItemRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneItemRequestData data) { this.data = data; } - public BatchOperation op(OpEnum op) { - + public BatchOperation op(@javax.annotation.Nonnull OpEnum op) { this.op = op; return this; } - /** + /** * Batch operation type type. * @return op - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "add", required = true, value = "Batch operation type type.") - public OpEnum getOp() { return op; } - - public void setOp(OpEnum op) { + public void setOp(@javax.annotation.Nonnull OpEnum op) { this.op = op; } - public BatchOperation ref(BatchOperationRef ref) { - + public BatchOperation ref(@javax.annotation.Nonnull BatchOperationRef ref) { this.ref = ref; return this; } - /** + /** * Get ref * @return ref - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public BatchOperationRef getRef() { return ref; } - - public void setRef(BatchOperationRef ref) { + public void setRef(@javax.annotation.Nonnull BatchOperationRef ref) { this.ref = ref; } + @Override public boolean equals(Object o) { if (this == o) { @@ -200,5 +219,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("op"); + openapiFields.add("ref"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("op"); + openapiRequiredFields.add("ref"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BatchOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BatchOperation is not found in the empty JSON string", BatchOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneItemRequestData.validateJsonElement(jsonObj.get("data")); + if (!jsonObj.get("op").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `op` to be a primitive type in the JSON string but got `%s`", jsonObj.get("op").toString())); + } + // validate the required field `op` + OpEnum.validateJsonElement(jsonObj.get("op")); + // validate the required field `ref` + BatchOperationRef.validateJsonElement(jsonObj.get("ref")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BatchOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BatchOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchOperation + * @throws IOException if the JSON string is invalid with respect to BatchOperation + */ + public static BatchOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchOperation.class); + } + + /** + * Convert an instance of BatchOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/BatchOperationRef.java b/src/main/java/com/vertexvis/model/BatchOperationRef.java index ed2f660..520e3ee 100644 --- a/src/main/java/com/vertexvis/model/BatchOperationRef.java +++ b/src/main/java/com/vertexvis/model/BatchOperationRef.java @@ -14,22 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * Target of batch operation. */ -@ApiModel(description = "Target of batch operation.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class BatchOperationRef { /** * Resource object type. @@ -74,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public BatchOperationRef() { + public BatchOperationRef() { } - public BatchOperationRef type(TypeEnum type) { - + public BatchOperationRef type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public BatchOperationRef id(UUID id) { - + public BatchOperationRef id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -172,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BatchOperationRef + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchOperationRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BatchOperationRef is not found in the empty JSON string", BatchOperationRef.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchOperationRef.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchOperationRef` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchOperationRef.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchOperationRef.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchOperationRef' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BatchOperationRef.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchOperationRef value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchOperationRef read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BatchOperationRef given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchOperationRef + * @throws IOException if the JSON string is invalid with respect to BatchOperationRef + */ + public static BatchOperationRef fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchOperationRef.class); + } + + /** + * Convert an instance of BatchOperationRef to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/BatchVertexvisBatchResultsInner.java b/src/main/java/com/vertexvis/model/BatchVertexvisBatchResultsInner.java new file mode 100644 index 0000000..a739ea4 --- /dev/null +++ b/src/main/java/com/vertexvis/model/BatchVertexvisBatchResultsInner.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.ApiError; +import com.vertexvis.model.ApiErrorSource; +import com.vertexvis.model.Link; +import com.vertexvis.model.RelationshipData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class BatchVertexvisBatchResultsInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(BatchVertexvisBatchResultsInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchVertexvisBatchResultsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchVertexvisBatchResultsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterRelationshipData = gson.getDelegateAdapter(this, TypeToken.get(RelationshipData.class)); + final TypeAdapter adapterApiError = gson.getDelegateAdapter(this, TypeToken.get(ApiError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchVertexvisBatchResultsInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `RelationshipData` + if (value.getActualInstance() instanceof RelationshipData) { + JsonElement element = adapterRelationshipData.toJsonTree((RelationshipData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ApiError` + if (value.getActualInstance() instanceof ApiError) { + JsonElement element = adapterApiError.toJsonTree((ApiError)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: ApiError, RelationshipData"); + } + + @Override + public BatchVertexvisBatchResultsInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize RelationshipData + try { + // validate the JSON object to see if any exception is thrown + RelationshipData.validateJsonElement(jsonElement); + actualAdapter = adapterRelationshipData; + BatchVertexvisBatchResultsInner ret = new BatchVertexvisBatchResultsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for RelationshipData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'RelationshipData'", e); + } + // deserialize ApiError + try { + // validate the JSON object to see if any exception is thrown + ApiError.validateJsonElement(jsonElement); + actualAdapter = adapterApiError; + BatchVertexvisBatchResultsInner ret = new BatchVertexvisBatchResultsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ApiError failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ApiError'", e); + } + + throw new IOException(String.format("Failed deserialization for BatchVertexvisBatchResultsInner: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public BatchVertexvisBatchResultsInner() { + super("anyOf", Boolean.FALSE); + } + + public BatchVertexvisBatchResultsInner(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("RelationshipData", RelationshipData.class); + schemas.put("ApiError", ApiError.class); + } + + @Override + public Map> getSchemas() { + return BatchVertexvisBatchResultsInner.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * ApiError, RelationshipData + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof RelationshipData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ApiError) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ApiError, RelationshipData"); + } + + /** + * Get the actual instance, which can be the following: + * ApiError, RelationshipData + * + * @return The actual instance (ApiError, RelationshipData) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `RelationshipData`. If the actual instance is not `RelationshipData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `RelationshipData` + * @throws ClassCastException if the instance is not `RelationshipData` + */ + public RelationshipData getRelationshipData() throws ClassCastException { + return (RelationshipData)super.getActualInstance(); + } + + /** + * Get the actual instance of `ApiError`. If the actual instance is not `ApiError`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ApiError` + * @throws ClassCastException if the instance is not `ApiError` + */ + public ApiError getApiError() throws ClassCastException { + return (ApiError)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BatchVertexvisBatchResultsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with RelationshipData + try { + RelationshipData.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for RelationshipData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ApiError + try { + ApiError.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ApiError failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for BatchVertexvisBatchResultsInner with anyOf schemas: ApiError, RelationshipData. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of BatchVertexvisBatchResultsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchVertexvisBatchResultsInner + * @throws IOException if the JSON string is invalid with respect to BatchVertexvisBatchResultsInner + */ + public static BatchVertexvisBatchResultsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchVertexvisBatchResultsInner.class); + } + + /** + * Convert an instance of BatchVertexvisBatchResultsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/BoundingBox.java b/src/main/java/com/vertexvis/model/BoundingBox.java index d570059..88f4d09 100644 --- a/src/main/java/com/vertexvis/model/BoundingBox.java +++ b/src/main/java/com/vertexvis/model/BoundingBox.java @@ -14,80 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * 3D bounding-box */ -@ApiModel(description = "3D bounding-box") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class BoundingBox { public static final String SERIALIZED_NAME_MIN = "min"; @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nonnull private Vector3 min; public static final String SERIALIZED_NAME_MAX = "max"; @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nonnull private Vector3 max; - public BoundingBox() { + public BoundingBox() { } - public BoundingBox min(Vector3 min) { - + public BoundingBox min(@javax.annotation.Nonnull Vector3 min) { this.min = min; return this; } - /** + /** * Get min * @return min - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getMin() { return min; } - - public void setMin(Vector3 min) { + public void setMin(@javax.annotation.Nonnull Vector3 min) { this.min = min; } - public BoundingBox max(Vector3 max) { - + public BoundingBox max(@javax.annotation.Nonnull Vector3 max) { this.max = max; return this; } - /** + /** * Get max * @return max - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getMax() { return max; } - - public void setMax(Vector3 max) { + public void setMax(@javax.annotation.Nonnull Vector3 max) { this.max = max; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +142,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("min"); + openapiFields.add("max"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("min"); + openapiRequiredFields.add("max"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BoundingBox + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BoundingBox.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BoundingBox is not found in the empty JSON string", BoundingBox.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BoundingBox.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BoundingBox` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BoundingBox.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `min` + Vector3.validateJsonElement(jsonObj.get("min")); + // validate the required field `max` + Vector3.validateJsonElement(jsonObj.get("max")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BoundingBox.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BoundingBox' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BoundingBox.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BoundingBox value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BoundingBox read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BoundingBox given an JSON string + * + * @param jsonString JSON string + * @return An instance of BoundingBox + * @throws IOException if the JSON string is invalid with respect to BoundingBox + */ + public static BoundingBox fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BoundingBox.class); + } + + /** + * Convert an instance of BoundingBox to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CADExportConfig.java b/src/main/java/com/vertexvis/model/CADExportConfig.java index ac16fcc..b87acc8 100644 --- a/src/main/java/com/vertexvis/model/CADExportConfig.java +++ b/src/main/java/com/vertexvis/model/CADExportConfig.java @@ -14,27 +14,48 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Describes the options for configuring a CAD file export. */ -@ApiModel(description = "Describes the options for configuring a CAD file export.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CADExportConfig extends ExportConfig { - public CADExportConfig() { + public CADExportConfig() { this.format = this.getClass().getSimpleName(); } + @Override public boolean equals(Object o) { if (this == o) { @@ -71,5 +92,96 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("format"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CADExportConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CADExportConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CADExportConfig is not found in the empty JSON string", CADExportConfig.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CADExportConfig.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CADExportConfig` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CADExportConfig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CADExportConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CADExportConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CADExportConfig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CADExportConfig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CADExportConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CADExportConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of CADExportConfig + * @throws IOException if the JSON string is invalid with respect to CADExportConfig + */ + public static CADExportConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CADExportConfig.class); + } + + /** + * Convert an instance of CADExportConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Camera.java b/src/main/java/com/vertexvis/model/Camera.java deleted file mode 100644 index d7572ec..0000000 --- a/src/main/java/com/vertexvis/model/Camera.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vertexvis.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; - -// Created class for deserializing the OneOfOrthographicPerspective camera adapter. -public class Camera extends OrthographicCamera { - public static final String SERIALIZED_NAME_POSITION = "position"; - @SerializedName(SERIALIZED_NAME_POSITION) - private Vector3 position; - public Camera position(Vector3 position) { - - this.position = position; - return this; - } - - /** - * Get position - * @return position - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Vector3 getPosition() { - return position; - } -} diff --git a/src/main/java/com/vertexvis/model/CameraFit.java b/src/main/java/com/vertexvis/model/CameraFit.java index dc73e91..7dce5fd 100644 --- a/src/main/java/com/vertexvis/model/CameraFit.java +++ b/src/main/java/com/vertexvis/model/CameraFit.java @@ -14,21 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * Fit camera in 3D space based on items in scene. */ -@ApiModel(description = "Fit camera in 3D space based on items in scene.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CameraFit { /** * Resource object type. @@ -75,38 +95,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public CameraFit() { + public CameraFit() { } - public CameraFit type(TypeEnum type) { - + public CameraFit type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "fit-visible-scene-items", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -144,5 +167,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CameraFit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CameraFit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CameraFit is not found in the empty JSON string", CameraFit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CameraFit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CameraFit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CameraFit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CameraFit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CameraFit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CameraFit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CameraFit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CameraFit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CameraFit given an JSON string + * + * @param jsonString JSON string + * @return An instance of CameraFit + * @throws IOException if the JSON string is invalid with respect to CameraFit + */ + public static CameraFit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CameraFit.class); + } + + /** + * Convert an instance of CameraFit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ChangeMaterialOp.java b/src/main/java/com/vertexvis/model/ChangeMaterialOp.java index 3b1ad7c..4de7ac1 100644 --- a/src/main/java/com/vertexvis/model/ChangeMaterialOp.java +++ b/src/main/java/com/vertexvis/model/ChangeMaterialOp.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterial; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ChangeMaterialOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ChangeMaterialOp { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_MATERIAL = "material"; @SerializedName(SERIALIZED_NAME_MATERIAL) + @javax.annotation.Nonnull private ColorMaterial material; - public ChangeMaterialOp() { + public ChangeMaterialOp() { } - public ChangeMaterialOp type(TypeEnum type) { - + public ChangeMaterialOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "change-material", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ChangeMaterialOp material(ColorMaterial material) { - + public ChangeMaterialOp material(@javax.annotation.Nonnull ColorMaterial material) { this.material = material; return this; } - /** + /** * Get material * @return material - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ColorMaterial getMaterial() { return material; } - - public void setMaterial(ColorMaterial material) { + public void setMaterial(@javax.annotation.Nonnull ColorMaterial material) { this.material = material; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("material"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("material"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangeMaterialOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangeMaterialOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangeMaterialOp is not found in the empty JSON string", ChangeMaterialOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangeMaterialOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangeMaterialOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangeMaterialOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `material` + ColorMaterial.validateJsonElement(jsonObj.get("material")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangeMaterialOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangeMaterialOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangeMaterialOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangeMaterialOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangeMaterialOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangeMaterialOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangeMaterialOp + * @throws IOException if the JSON string is invalid with respect to ChangeMaterialOp + */ + public static ChangeMaterialOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangeMaterialOp.class); + } + + /** + * Convert an instance of ChangeMaterialOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ChangeTransformOp.java b/src/main/java/com/vertexvis/model/ChangeTransformOp.java index 1f5577a..b20898d 100644 --- a/src/main/java/com/vertexvis/model/ChangeTransformOp.java +++ b/src/main/java/com/vertexvis/model/ChangeTransformOp.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ChangeTransformOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ChangeTransformOp { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nonnull private Matrix4 transform; - public ChangeTransformOp() { + public ChangeTransformOp() { } - public ChangeTransformOp type(TypeEnum type) { - + public ChangeTransformOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "change-transform", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ChangeTransformOp transform(Matrix4 transform) { - + public ChangeTransformOp transform(@javax.annotation.Nonnull Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nonnull Matrix4 transform) { this.transform = transform; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("transform"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("transform"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangeTransformOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangeTransformOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangeTransformOp is not found in the empty JSON string", ChangeTransformOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangeTransformOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangeTransformOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangeTransformOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `transform` + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangeTransformOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangeTransformOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangeTransformOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangeTransformOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangeTransformOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangeTransformOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangeTransformOp + * @throws IOException if the JSON string is invalid with respect to ChangeTransformOp + */ + public static ChangeTransformOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangeTransformOp.class); + } + + /** + * Convert an instance of ChangeTransformOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ChangeVisibilityOp.java b/src/main/java/com/vertexvis/model/ChangeVisibilityOp.java index 50eed65..887e2e6 100644 --- a/src/main/java/com/vertexvis/model/ChangeVisibilityOp.java +++ b/src/main/java/com/vertexvis/model/ChangeVisibilityOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ChangeVisibilityOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ChangeVisibilityOp { /** * Resource object type. @@ -72,65 +93,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nonnull private Boolean visible; - public ChangeVisibilityOp() { + public ChangeVisibilityOp() { } - public ChangeVisibilityOp type(TypeEnum type) { - + public ChangeVisibilityOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "change-visibility", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ChangeVisibilityOp visible(Boolean visible) { - + public ChangeVisibilityOp visible(@javax.annotation.Nonnull Boolean visible) { this.visible = visible; return this; } - /** + /** * Item visibility. * @return visible - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "true", required = true, value = "Item visibility.") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nonnull Boolean visible) { this.visible = visible; } + @Override public boolean equals(Object o) { if (this == o) { @@ -170,5 +191,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("visible"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("visible"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangeVisibilityOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangeVisibilityOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangeVisibilityOp is not found in the empty JSON string", ChangeVisibilityOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangeVisibilityOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangeVisibilityOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangeVisibilityOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangeVisibilityOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangeVisibilityOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangeVisibilityOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangeVisibilityOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangeVisibilityOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangeVisibilityOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangeVisibilityOp + * @throws IOException if the JSON string is invalid with respect to ChangeVisibilityOp + */ + public static ChangeVisibilityOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangeVisibilityOp.class); + } + + /** + * Convert an instance of ChangeVisibilityOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ClearMaterialOp.java b/src/main/java/com/vertexvis/model/ClearMaterialOp.java index 4f3f641..3db00e1 100644 --- a/src/main/java/com/vertexvis/model/ClearMaterialOp.java +++ b/src/main/java/com/vertexvis/model/ClearMaterialOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ClearMaterialOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ClearMaterialOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public ClearMaterialOp() { + public ClearMaterialOp() { } - public ClearMaterialOp type(TypeEnum type) { - + public ClearMaterialOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "clear-material", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClearMaterialOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClearMaterialOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClearMaterialOp is not found in the empty JSON string", ClearMaterialOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClearMaterialOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClearMaterialOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClearMaterialOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClearMaterialOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClearMaterialOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClearMaterialOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClearMaterialOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClearMaterialOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClearMaterialOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClearMaterialOp + * @throws IOException if the JSON string is invalid with respect to ClearMaterialOp + */ + public static ClearMaterialOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClearMaterialOp.class); + } + + /** + * Convert an instance of ClearMaterialOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ClearRenOp.java b/src/main/java/com/vertexvis/model/ClearRenOp.java index 633ecc1..0ec9596 100644 --- a/src/main/java/com/vertexvis/model/ClearRenOp.java +++ b/src/main/java/com/vertexvis/model/ClearRenOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ClearRenOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ClearRenOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public ClearRenOp() { + public ClearRenOp() { } - public ClearRenOp type(TypeEnum type) { - + public ClearRenOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "clear-rendition", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClearRenOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClearRenOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClearRenOp is not found in the empty JSON string", ClearRenOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClearRenOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClearRenOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClearRenOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClearRenOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClearRenOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClearRenOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClearRenOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClearRenOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClearRenOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClearRenOp + * @throws IOException if the JSON string is invalid with respect to ClearRenOp + */ + public static ClearRenOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClearRenOp.class); + } + + /** + * Convert an instance of ClearRenOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ClearRepOp.java b/src/main/java/com/vertexvis/model/ClearRepOp.java index 63aa719..9db8814 100644 --- a/src/main/java/com/vertexvis/model/ClearRepOp.java +++ b/src/main/java/com/vertexvis/model/ClearRepOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ClearRepOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ClearRepOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public ClearRepOp() { + public ClearRepOp() { } - public ClearRepOp type(TypeEnum type) { - + public ClearRepOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "clear-representation", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClearRepOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClearRepOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClearRepOp is not found in the empty JSON string", ClearRepOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClearRepOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClearRepOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClearRepOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClearRepOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClearRepOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClearRepOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClearRepOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClearRepOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClearRepOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClearRepOp + * @throws IOException if the JSON string is invalid with respect to ClearRepOp + */ + public static ClearRepOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClearRepOp.class); + } + + /** + * Convert an instance of ClearRepOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ClearTransformOp.java b/src/main/java/com/vertexvis/model/ClearTransformOp.java index 1e80065..dffac6b 100644 --- a/src/main/java/com/vertexvis/model/ClearTransformOp.java +++ b/src/main/java/com/vertexvis/model/ClearTransformOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ClearTransformOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ClearTransformOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public ClearTransformOp() { + public ClearTransformOp() { } - public ClearTransformOp type(TypeEnum type) { - + public ClearTransformOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "clear-transform", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClearTransformOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClearTransformOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClearTransformOp is not found in the empty JSON string", ClearTransformOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClearTransformOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClearTransformOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClearTransformOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClearTransformOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClearTransformOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClearTransformOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClearTransformOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClearTransformOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClearTransformOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClearTransformOp + * @throws IOException if the JSON string is invalid with respect to ClearTransformOp + */ + public static ClearTransformOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClearTransformOp.class); + } + + /** + * Convert an instance of ClearTransformOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Color3.java b/src/main/java/com/vertexvis/model/Color3.java index 1a0ae11..9cc714f 100644 --- a/src/main/java/com/vertexvis/model/Color3.java +++ b/src/main/java/com/vertexvis/model/Color3.java @@ -14,112 +14,124 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * RGB color. */ -@ApiModel(description = "RGB color.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Color3 { public static final String SERIALIZED_NAME_R = "r"; @SerializedName(SERIALIZED_NAME_R) + @javax.annotation.Nonnull private Integer r; public static final String SERIALIZED_NAME_G = "g"; @SerializedName(SERIALIZED_NAME_G) + @javax.annotation.Nonnull private Integer g; public static final String SERIALIZED_NAME_B = "b"; @SerializedName(SERIALIZED_NAME_B) + @javax.annotation.Nonnull private Integer b; - public Color3() { + public Color3() { } - public Color3 r(Integer r) { - + public Color3 r(@javax.annotation.Nonnull Integer r) { this.r = r; return this; } - /** + /** * Color value from 0 to 255. * minimum: 0 * maximum: 255 * @return r - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "255", required = true, value = "Color value from 0 to 255.") - public Integer getR() { return r; } - - public void setR(Integer r) { + public void setR(@javax.annotation.Nonnull Integer r) { this.r = r; } - public Color3 g(Integer g) { - + public Color3 g(@javax.annotation.Nonnull Integer g) { this.g = g; return this; } - /** + /** * Color value from 0 to 255. * minimum: 0 * maximum: 255 * @return g - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "255", required = true, value = "Color value from 0 to 255.") - public Integer getG() { return g; } - - public void setG(Integer g) { + public void setG(@javax.annotation.Nonnull Integer g) { this.g = g; } - public Color3 b(Integer b) { - + public Color3 b(@javax.annotation.Nonnull Integer b) { this.b = b; return this; } - /** + /** * Color value from 0 to 255. * minimum: 0 * maximum: 255 * @return b - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "255", required = true, value = "Color value from 0 to 255.") - public Integer getB() { return b; } - - public void setB(Integer b) { + public void setB(@javax.annotation.Nonnull Integer b) { this.b = b; } + @Override public boolean equals(Object o) { if (this == o) { @@ -161,5 +173,101 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("r"); + openapiFields.add("g"); + openapiFields.add("b"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("r"); + openapiRequiredFields.add("g"); + openapiRequiredFields.add("b"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Color3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Color3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Color3 is not found in the empty JSON string", Color3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Color3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Color3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Color3.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Color3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Color3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Color3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Color3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Color3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Color3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Color3 + * @throws IOException if the JSON string is invalid with respect to Color3 + */ + public static Color3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Color3.class); + } + + /** + * Convert an instance of Color3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ColorMaterial.java b/src/main/java/com/vertexvis/model/ColorMaterial.java index 231afa9..d05f78b 100644 --- a/src/main/java/com/vertexvis/model/ColorMaterial.java +++ b/src/main/java/com/vertexvis/model/ColorMaterial.java @@ -14,192 +14,195 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Color3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Color properties describing how a material looks. */ -@ApiModel(description = "Color properties describing how a material looks.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ColorMaterial { public static final String SERIALIZED_NAME_OPACITY = "opacity"; @SerializedName(SERIALIZED_NAME_OPACITY) + @javax.annotation.Nonnull private Integer opacity; public static final String SERIALIZED_NAME_GLOSSINESS = "glossiness"; @SerializedName(SERIALIZED_NAME_GLOSSINESS) + @javax.annotation.Nonnull private Integer glossiness; public static final String SERIALIZED_NAME_AMBIENT = "ambient"; @SerializedName(SERIALIZED_NAME_AMBIENT) + @javax.annotation.Nonnull private Color3 ambient; public static final String SERIALIZED_NAME_DIFFUSE = "diffuse"; @SerializedName(SERIALIZED_NAME_DIFFUSE) + @javax.annotation.Nonnull private Color3 diffuse; public static final String SERIALIZED_NAME_SPECULAR = "specular"; @SerializedName(SERIALIZED_NAME_SPECULAR) + @javax.annotation.Nonnull private Color3 specular; public static final String SERIALIZED_NAME_EMISSIVE = "emissive"; @SerializedName(SERIALIZED_NAME_EMISSIVE) + @javax.annotation.Nonnull private Color3 emissive; - public ColorMaterial() { + public ColorMaterial() { } - public ColorMaterial opacity(Integer opacity) { - + public ColorMaterial opacity(@javax.annotation.Nonnull Integer opacity) { this.opacity = opacity; return this; } - /** + /** * An opacity value from 0 to 255. * minimum: 0 * maximum: 255 * @return opacity - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "255", required = true, value = "An opacity value from 0 to 255.") - public Integer getOpacity() { return opacity; } - - public void setOpacity(Integer opacity) { + public void setOpacity(@javax.annotation.Nonnull Integer opacity) { this.opacity = opacity; } - public ColorMaterial glossiness(Integer glossiness) { - + public ColorMaterial glossiness(@javax.annotation.Nonnull Integer glossiness) { this.glossiness = glossiness; return this; } - /** + /** * Glossiness from 0 to 128. * minimum: 0 * maximum: 128 * @return glossiness - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0", required = true, value = "Glossiness from 0 to 128.") - public Integer getGlossiness() { return glossiness; } - - public void setGlossiness(Integer glossiness) { + public void setGlossiness(@javax.annotation.Nonnull Integer glossiness) { this.glossiness = glossiness; } - public ColorMaterial ambient(Color3 ambient) { - + public ColorMaterial ambient(@javax.annotation.Nonnull Color3 ambient) { this.ambient = ambient; return this; } - /** + /** * Get ambient * @return ambient - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getAmbient() { return ambient; } - - public void setAmbient(Color3 ambient) { + public void setAmbient(@javax.annotation.Nonnull Color3 ambient) { this.ambient = ambient; } - public ColorMaterial diffuse(Color3 diffuse) { - + public ColorMaterial diffuse(@javax.annotation.Nonnull Color3 diffuse) { this.diffuse = diffuse; return this; } - /** + /** * Get diffuse * @return diffuse - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getDiffuse() { return diffuse; } - - public void setDiffuse(Color3 diffuse) { + public void setDiffuse(@javax.annotation.Nonnull Color3 diffuse) { this.diffuse = diffuse; } - public ColorMaterial specular(Color3 specular) { - + public ColorMaterial specular(@javax.annotation.Nonnull Color3 specular) { this.specular = specular; return this; } - /** + /** * Get specular * @return specular - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getSpecular() { return specular; } - - public void setSpecular(Color3 specular) { + public void setSpecular(@javax.annotation.Nonnull Color3 specular) { this.specular = specular; } - public ColorMaterial emissive(Color3 emissive) { - + public ColorMaterial emissive(@javax.annotation.Nonnull Color3 emissive) { this.emissive = emissive; return this; } - /** + /** * Get emissive * @return emissive - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getEmissive() { return emissive; } - - public void setEmissive(Color3 emissive) { + public void setEmissive(@javax.annotation.Nonnull Color3 emissive) { this.emissive = emissive; } + @Override public boolean equals(Object o) { if (this == o) { @@ -247,5 +250,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("opacity"); + openapiFields.add("glossiness"); + openapiFields.add("ambient"); + openapiFields.add("diffuse"); + openapiFields.add("specular"); + openapiFields.add("emissive"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("opacity"); + openapiRequiredFields.add("glossiness"); + openapiRequiredFields.add("ambient"); + openapiRequiredFields.add("diffuse"); + openapiRequiredFields.add("specular"); + openapiRequiredFields.add("emissive"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ColorMaterial + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ColorMaterial.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ColorMaterial is not found in the empty JSON string", ColorMaterial.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ColorMaterial.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ColorMaterial` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ColorMaterial.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `ambient` + Color3.validateJsonElement(jsonObj.get("ambient")); + // validate the required field `diffuse` + Color3.validateJsonElement(jsonObj.get("diffuse")); + // validate the required field `specular` + Color3.validateJsonElement(jsonObj.get("specular")); + // validate the required field `emissive` + Color3.validateJsonElement(jsonObj.get("emissive")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ColorMaterial.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ColorMaterial' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ColorMaterial.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ColorMaterial value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ColorMaterial read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ColorMaterial given an JSON string + * + * @param jsonString JSON string + * @return An instance of ColorMaterial + * @throws IOException if the JSON string is invalid with respect to ColorMaterial + */ + public static ColorMaterial fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ColorMaterial.class); + } + + /** + * Convert an instance of ColorMaterial to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ColorMaterialNullable.java b/src/main/java/com/vertexvis/model/ColorMaterialNullable.java index 82a6ec8..c212bcc 100644 --- a/src/main/java/com/vertexvis/model/ColorMaterialNullable.java +++ b/src/main/java/com/vertexvis/model/ColorMaterialNullable.java @@ -14,192 +14,195 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Color3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Color properties describing how a material looks. */ -@ApiModel(description = "Color properties describing how a material looks.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ColorMaterialNullable { public static final String SERIALIZED_NAME_OPACITY = "opacity"; @SerializedName(SERIALIZED_NAME_OPACITY) + @javax.annotation.Nonnull private Integer opacity; public static final String SERIALIZED_NAME_GLOSSINESS = "glossiness"; @SerializedName(SERIALIZED_NAME_GLOSSINESS) + @javax.annotation.Nonnull private Integer glossiness; public static final String SERIALIZED_NAME_AMBIENT = "ambient"; @SerializedName(SERIALIZED_NAME_AMBIENT) + @javax.annotation.Nonnull private Color3 ambient; public static final String SERIALIZED_NAME_DIFFUSE = "diffuse"; @SerializedName(SERIALIZED_NAME_DIFFUSE) + @javax.annotation.Nonnull private Color3 diffuse; public static final String SERIALIZED_NAME_SPECULAR = "specular"; @SerializedName(SERIALIZED_NAME_SPECULAR) + @javax.annotation.Nonnull private Color3 specular; public static final String SERIALIZED_NAME_EMISSIVE = "emissive"; @SerializedName(SERIALIZED_NAME_EMISSIVE) + @javax.annotation.Nonnull private Color3 emissive; - public ColorMaterialNullable() { + public ColorMaterialNullable() { } - public ColorMaterialNullable opacity(Integer opacity) { - + public ColorMaterialNullable opacity(@javax.annotation.Nonnull Integer opacity) { this.opacity = opacity; return this; } - /** + /** * An opacity value from 0 to 255. * minimum: 0 * maximum: 255 * @return opacity - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "255", required = true, value = "An opacity value from 0 to 255.") - public Integer getOpacity() { return opacity; } - - public void setOpacity(Integer opacity) { + public void setOpacity(@javax.annotation.Nonnull Integer opacity) { this.opacity = opacity; } - public ColorMaterialNullable glossiness(Integer glossiness) { - + public ColorMaterialNullable glossiness(@javax.annotation.Nonnull Integer glossiness) { this.glossiness = glossiness; return this; } - /** + /** * Glossiness from 0 to 128. * minimum: 0 * maximum: 128 * @return glossiness - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0", required = true, value = "Glossiness from 0 to 128.") - public Integer getGlossiness() { return glossiness; } - - public void setGlossiness(Integer glossiness) { + public void setGlossiness(@javax.annotation.Nonnull Integer glossiness) { this.glossiness = glossiness; } - public ColorMaterialNullable ambient(Color3 ambient) { - + public ColorMaterialNullable ambient(@javax.annotation.Nonnull Color3 ambient) { this.ambient = ambient; return this; } - /** + /** * Get ambient * @return ambient - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getAmbient() { return ambient; } - - public void setAmbient(Color3 ambient) { + public void setAmbient(@javax.annotation.Nonnull Color3 ambient) { this.ambient = ambient; } - public ColorMaterialNullable diffuse(Color3 diffuse) { - + public ColorMaterialNullable diffuse(@javax.annotation.Nonnull Color3 diffuse) { this.diffuse = diffuse; return this; } - /** + /** * Get diffuse * @return diffuse - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getDiffuse() { return diffuse; } - - public void setDiffuse(Color3 diffuse) { + public void setDiffuse(@javax.annotation.Nonnull Color3 diffuse) { this.diffuse = diffuse; } - public ColorMaterialNullable specular(Color3 specular) { - + public ColorMaterialNullable specular(@javax.annotation.Nonnull Color3 specular) { this.specular = specular; return this; } - /** + /** * Get specular * @return specular - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getSpecular() { return specular; } - - public void setSpecular(Color3 specular) { + public void setSpecular(@javax.annotation.Nonnull Color3 specular) { this.specular = specular; } - public ColorMaterialNullable emissive(Color3 emissive) { - + public ColorMaterialNullable emissive(@javax.annotation.Nonnull Color3 emissive) { this.emissive = emissive; return this; } - /** + /** * Get emissive * @return emissive - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getEmissive() { return emissive; } - - public void setEmissive(Color3 emissive) { + public void setEmissive(@javax.annotation.Nonnull Color3 emissive) { this.emissive = emissive; } + @Override public boolean equals(Object o) { if (this == o) { @@ -247,5 +250,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("opacity"); + openapiFields.add("glossiness"); + openapiFields.add("ambient"); + openapiFields.add("diffuse"); + openapiFields.add("specular"); + openapiFields.add("emissive"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("opacity"); + openapiRequiredFields.add("glossiness"); + openapiRequiredFields.add("ambient"); + openapiRequiredFields.add("diffuse"); + openapiRequiredFields.add("specular"); + openapiRequiredFields.add("emissive"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ColorMaterialNullable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ColorMaterialNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ColorMaterialNullable is not found in the empty JSON string", ColorMaterialNullable.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ColorMaterialNullable.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ColorMaterialNullable` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ColorMaterialNullable.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `ambient` + Color3.validateJsonElement(jsonObj.get("ambient")); + // validate the required field `diffuse` + Color3.validateJsonElement(jsonObj.get("diffuse")); + // validate the required field `specular` + Color3.validateJsonElement(jsonObj.get("specular")); + // validate the required field `emissive` + Color3.validateJsonElement(jsonObj.get("emissive")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ColorMaterialNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ColorMaterialNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ColorMaterialNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ColorMaterialNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ColorMaterialNullable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ColorMaterialNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of ColorMaterialNullable + * @throws IOException if the JSON string is invalid with respect to ColorMaterialNullable + */ + public static ColorMaterialNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ColorMaterialNullable.class); + } + + /** + * Convert an instance of ColorMaterialNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateAccountRequest.java b/src/main/java/com/vertexvis/model/CreateAccountRequest.java index e2c349a..abf1f71 100644 --- a/src/main/java/com/vertexvis/model/CreateAccountRequest.java +++ b/src/main/java/com/vertexvis/model/CreateAccountRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateAccountRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateAccountRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateAccountRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateAccountRequestData data; - public CreateAccountRequest() { + public CreateAccountRequest() { } - public CreateAccountRequest data(CreateAccountRequestData data) { - + public CreateAccountRequest data(@javax.annotation.Nonnull CreateAccountRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateAccountRequestData getData() { return data; } - - public void setData(CreateAccountRequestData data) { + public void setData(@javax.annotation.Nonnull CreateAccountRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAccountRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccountRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAccountRequest is not found in the empty JSON string", CreateAccountRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAccountRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAccountRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAccountRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateAccountRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccountRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccountRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAccountRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccountRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAccountRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAccountRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccountRequest + * @throws IOException if the JSON string is invalid with respect to CreateAccountRequest + */ + public static CreateAccountRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccountRequest.class); + } + + /** + * Convert an instance of CreateAccountRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateAccountRequestData.java b/src/main/java/com/vertexvis/model/CreateAccountRequestData.java index 234f151..2627a38 100644 --- a/src/main/java/com/vertexvis/model/CreateAccountRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateAccountRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateAccountRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateAccountRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateAccountRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateAccountRequestDataAttributes attributes; - public CreateAccountRequestData() { + public CreateAccountRequestData() { } - public CreateAccountRequestData type(String type) { - + public CreateAccountRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateAccountRequestData attributes(CreateAccountRequestDataAttributes attributes) { - + public CreateAccountRequestData attributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateAccountRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateAccountRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAccountRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccountRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAccountRequestData is not found in the empty JSON string", CreateAccountRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAccountRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAccountRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAccountRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccountRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccountRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAccountRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccountRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAccountRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAccountRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccountRequestData + * @throws IOException if the JSON string is invalid with respect to CreateAccountRequestData + */ + public static CreateAccountRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccountRequestData.class); + } + + /** + * Convert an instance of CreateAccountRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateAccountRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateAccountRequestDataAttributes.java index ac1c5e3..5b67750 100644 --- a/src/main/java/com/vertexvis/model/CreateAccountRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateAccountRequestDataAttributes.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateAccountRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateAccountRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; - public CreateAccountRequestDataAttributes() { + public CreateAccountRequestDataAttributes() { } - public CreateAccountRequestDataAttributes name(String name) { - + public CreateAccountRequestDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAccountRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccountRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAccountRequestDataAttributes is not found in the empty JSON string", CreateAccountRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAccountRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAccountRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAccountRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccountRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccountRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAccountRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccountRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAccountRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAccountRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccountRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAccountRequestDataAttributes + */ + public static CreateAccountRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccountRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateAccountRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateApplicationRequest.java b/src/main/java/com/vertexvis/model/CreateApplicationRequest.java index 05aa073..b02c556 100644 --- a/src/main/java/com/vertexvis/model/CreateApplicationRequest.java +++ b/src/main/java/com/vertexvis/model/CreateApplicationRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateAccountRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateApplicationRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateApplicationRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateAccountRequestData data; - public CreateApplicationRequest() { + public CreateApplicationRequest() { } - public CreateApplicationRequest data(CreateAccountRequestData data) { - + public CreateApplicationRequest data(@javax.annotation.Nonnull CreateAccountRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateAccountRequestData getData() { return data; } - - public void setData(CreateAccountRequestData data) { + public void setData(@javax.annotation.Nonnull CreateAccountRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApplicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApplicationRequest is not found in the empty JSON string", CreateApplicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApplicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApplicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateApplicationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateAccountRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApplicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApplicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApplicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplicationRequest + * @throws IOException if the JSON string is invalid with respect to CreateApplicationRequest + */ + public static CreateApplicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplicationRequest.class); + } + + /** + * Convert an instance of CreateApplicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateBatchRequest.java b/src/main/java/com/vertexvis/model/CreateBatchRequest.java index 7067ac0..44abce2 100644 --- a/src/main/java/com/vertexvis/model/CreateBatchRequest.java +++ b/src/main/java/com/vertexvis/model/CreateBatchRequest.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.BatchOperation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateBatchRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateBatchRequest { - public static final String SERIALIZED_NAME_VERTEXVIS_BATCH_COLON_OPERATIONS = "vertexvis/batch:operations"; - @SerializedName(SERIALIZED_NAME_VERTEXVIS_BATCH_COLON_OPERATIONS) - private List vertexvisBatchColonOperations = new ArrayList<>(); + public static final String SERIALIZED_NAME_VERTEXVIS_BATCH_OPERATIONS = "vertexvis/batch:operations"; + @SerializedName(SERIALIZED_NAME_VERTEXVIS_BATCH_OPERATIONS) + @javax.annotation.Nonnull + private List vertexvisBatchOperations = new ArrayList<>(); - public CreateBatchRequest() { + public CreateBatchRequest() { } - public CreateBatchRequest vertexvisBatchColonOperations(List vertexvisBatchColonOperations) { - - this.vertexvisBatchColonOperations = vertexvisBatchColonOperations; + public CreateBatchRequest vertexvisBatchOperations(@javax.annotation.Nonnull List vertexvisBatchOperations) { + this.vertexvisBatchOperations = vertexvisBatchOperations; return this; } - public CreateBatchRequest addVertexvisBatchColonOperationsItem(BatchOperation vertexvisBatchColonOperationsItem) { - this.vertexvisBatchColonOperations.add(vertexvisBatchColonOperationsItem); + public CreateBatchRequest addVertexvisBatchOperationsItem(BatchOperation vertexvisBatchOperationsItem) { + if (this.vertexvisBatchOperations == null) { + this.vertexvisBatchOperations = new ArrayList<>(); + } + this.vertexvisBatchOperations.add(vertexvisBatchOperationsItem); return this; } - /** + /** * List of operations to perform as a batch. - * @return vertexvisBatchColonOperations - **/ + * @return vertexvisBatchOperations + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "List of operations to perform as a batch.") - - public List getVertexvisBatchColonOperations() { - return vertexvisBatchColonOperations; + public List getVertexvisBatchOperations() { + return vertexvisBatchOperations; } - - public void setVertexvisBatchColonOperations(List vertexvisBatchColonOperations) { - this.vertexvisBatchColonOperations = vertexvisBatchColonOperations; + public void setVertexvisBatchOperations(@javax.annotation.Nonnull List vertexvisBatchOperations) { + this.vertexvisBatchOperations = vertexvisBatchOperations; } + @Override public boolean equals(Object o) { if (this == o) { @@ -76,19 +98,19 @@ public boolean equals(Object o) { return false; } CreateBatchRequest createBatchRequest = (CreateBatchRequest) o; - return Objects.equals(this.vertexvisBatchColonOperations, createBatchRequest.vertexvisBatchColonOperations); + return Objects.equals(this.vertexvisBatchOperations, createBatchRequest.vertexvisBatchOperations); } @Override public int hashCode() { - return Objects.hash(vertexvisBatchColonOperations); + return Objects.hash(vertexvisBatchOperations); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateBatchRequest {\n"); - sb.append(" vertexvisBatchColonOperations: ").append(toIndentedString(vertexvisBatchColonOperations)).append("\n"); + sb.append(" vertexvisBatchOperations: ").append(toIndentedString(vertexvisBatchOperations)).append("\n"); sb.append("}"); return sb.toString(); } @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("vertexvis/batch:operations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("vertexvis/batch:operations"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBatchRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBatchRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBatchRequest is not found in the empty JSON string", CreateBatchRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBatchRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBatchRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBatchRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("vertexvis/batch:operations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `vertexvis/batch:operations` to be an array in the JSON string but got `%s`", jsonObj.get("vertexvis/batch:operations").toString())); + } + + JsonArray jsonArrayvertexvisBatchOperations = jsonObj.getAsJsonArray("vertexvis/batch:operations"); + // validate the required field `vertexvis/batch:operations` (array) + for (int i = 0; i < jsonArrayvertexvisBatchOperations.size(); i++) { + BatchOperation.validateJsonElement(jsonArrayvertexvisBatchOperations.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBatchRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBatchRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBatchRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBatchRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBatchRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBatchRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBatchRequest + * @throws IOException if the JSON string is invalid with respect to CreateBatchRequest + */ + public static CreateBatchRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBatchRequest.class); + } + + /** + * Convert an instance of CreateBatchRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateExportRequest.java b/src/main/java/com/vertexvis/model/CreateExportRequest.java index 9a38ff4..407ec3c 100644 --- a/src/main/java/com/vertexvis/model/CreateExportRequest.java +++ b/src/main/java/com/vertexvis/model/CreateExportRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateExportRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateExportRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateExportRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateExportRequestData data; - public CreateExportRequest() { + public CreateExportRequest() { } - public CreateExportRequest data(CreateExportRequestData data) { - + public CreateExportRequest data(@javax.annotation.Nonnull CreateExportRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateExportRequestData getData() { return data; } - - public void setData(CreateExportRequestData data) { + public void setData(@javax.annotation.Nonnull CreateExportRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateExportRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateExportRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateExportRequest is not found in the empty JSON string", CreateExportRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateExportRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateExportRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateExportRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateExportRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateExportRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateExportRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateExportRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateExportRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateExportRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateExportRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateExportRequest + * @throws IOException if the JSON string is invalid with respect to CreateExportRequest + */ + public static CreateExportRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateExportRequest.class); + } + + /** + * Convert an instance of CreateExportRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateExportRequestData.java b/src/main/java/com/vertexvis/model/CreateExportRequestData.java index b8209f6..be63d95 100644 --- a/src/main/java/com/vertexvis/model/CreateExportRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateExportRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateExportRequestDataAttributes; import com.vertexvis.model.CreateExportRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateExportRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateExportRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateExportRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateExportRequestDataRelationships relationships; - public CreateExportRequestData() { + public CreateExportRequestData() { } - public CreateExportRequestData type(String type) { - + public CreateExportRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "export", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateExportRequestData attributes(CreateExportRequestDataAttributes attributes) { - + public CreateExportRequestData attributes(@javax.annotation.Nonnull CreateExportRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateExportRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateExportRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateExportRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateExportRequestData relationships(CreateExportRequestDataRelationships relationships) { - + public CreateExportRequestData relationships(@javax.annotation.Nonnull CreateExportRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateExportRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateExportRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateExportRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateExportRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateExportRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateExportRequestData is not found in the empty JSON string", CreateExportRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateExportRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateExportRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateExportRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateExportRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateExportRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateExportRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateExportRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateExportRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateExportRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateExportRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateExportRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateExportRequestData + * @throws IOException if the JSON string is invalid with respect to CreateExportRequestData + */ + public static CreateExportRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateExportRequestData.class); + } + + /** + * Convert an instance of CreateExportRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributes.java index 8ed0f0d..afbd686 100644 --- a/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributes.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.CADExportConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.CreateExportRequestDataAttributesConfig; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateExportRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateExportRequestDataAttributes { public static final String SERIALIZED_NAME_CONFIG = "config"; @SerializedName(SERIALIZED_NAME_CONFIG) - private OneOfCADExportConfig config; + @javax.annotation.Nonnull + private CreateExportRequestDataAttributesConfig config; public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nullable private String fileName; - public CreateExportRequestDataAttributes() { + public CreateExportRequestDataAttributes() { } - public CreateExportRequestDataAttributes config(OneOfCADExportConfig config) { - + public CreateExportRequestDataAttributes config(@javax.annotation.Nonnull CreateExportRequestDataAttributesConfig config) { this.config = config; return this; } - /** - * Specifies the export format and options to configure the export. + /** + * Get config * @return config - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "Specifies the export format and options to configure the export.") - - public OneOfCADExportConfig getConfig() { + */ + @javax.annotation.Nonnull + public CreateExportRequestDataAttributesConfig getConfig() { return config; } - - public void setConfig(OneOfCADExportConfig config) { + public void setConfig(@javax.annotation.Nonnull CreateExportRequestDataAttributesConfig config) { this.config = config; } - public CreateExportRequestDataAttributes fileName(String fileName) { - + public CreateExportRequestDataAttributes fileName(@javax.annotation.Nullable String fileName) { this.fileName = fileName; return this; } - /** + /** * Optional file name to use for the resulting export * @return fileName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "exportedScene", value = "Optional file name to use for the resulting export") - public String getFileName() { return fileName; } - - public void setFileName(String fileName) { + public void setFileName(@javax.annotation.Nullable String fileName) { this.fileName = fileName; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("config"); + openapiFields.add("fileName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("config"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateExportRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateExportRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateExportRequestDataAttributes is not found in the empty JSON string", CreateExportRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateExportRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateExportRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateExportRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `config` + CreateExportRequestDataAttributesConfig.validateJsonElement(jsonObj.get("config")); + if ((jsonObj.get("fileName") != null && !jsonObj.get("fileName").isJsonNull()) && !jsonObj.get("fileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateExportRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateExportRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateExportRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateExportRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateExportRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateExportRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateExportRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateExportRequestDataAttributes + */ + public static CreateExportRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateExportRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateExportRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributesConfig.java b/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributesConfig.java new file mode 100644 index 0000000..7115e8a --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateExportRequestDataAttributesConfig.java @@ -0,0 +1,230 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CADExportConfig; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateExportRequestDataAttributesConfig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateExportRequestDataAttributesConfig.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateExportRequestDataAttributesConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateExportRequestDataAttributesConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCADExportConfig = gson.getDelegateAdapter(this, TypeToken.get(CADExportConfig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateExportRequestDataAttributesConfig value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CADExportConfig` + if (value.getActualInstance() instanceof CADExportConfig) { + JsonElement element = adapterCADExportConfig.toJsonTree((CADExportConfig)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CADExportConfig"); + } + + @Override + public CreateExportRequestDataAttributesConfig read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CADExportConfig + try { + // validate the JSON object to see if any exception is thrown + CADExportConfig.validateJsonElement(jsonElement); + actualAdapter = adapterCADExportConfig; + match++; + log.log(Level.FINER, "Input data matches schema 'CADExportConfig'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CADExportConfig failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CADExportConfig'", e); + } + + if (match == 1) { + CreateExportRequestDataAttributesConfig ret = new CreateExportRequestDataAttributesConfig(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateExportRequestDataAttributesConfig: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateExportRequestDataAttributesConfig() { + super("oneOf", Boolean.FALSE); + } + + public CreateExportRequestDataAttributesConfig(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CADExportConfig", CADExportConfig.class); + } + + @Override + public Map> getSchemas() { + return CreateExportRequestDataAttributesConfig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CADExportConfig + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CADExportConfig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CADExportConfig"); + } + + /** + * Get the actual instance, which can be the following: + * CADExportConfig + * + * @return The actual instance (CADExportConfig) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CADExportConfig`. If the actual instance is not `CADExportConfig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CADExportConfig` + * @throws ClassCastException if the instance is not `CADExportConfig` + */ + public CADExportConfig getCADExportConfig() throws ClassCastException { + return (CADExportConfig)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateExportRequestDataAttributesConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CADExportConfig + try { + CADExportConfig.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CADExportConfig failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateExportRequestDataAttributesConfig with oneOf schemas: CADExportConfig. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateExportRequestDataAttributesConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateExportRequestDataAttributesConfig + * @throws IOException if the JSON string is invalid with respect to CreateExportRequestDataAttributesConfig + */ + public static CreateExportRequestDataAttributesConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateExportRequestDataAttributesConfig.class); + } + + /** + * Convert an instance of CreateExportRequestDataAttributesConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateExportRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateExportRequestDataRelationships.java index ea3e110..c117d9e 100644 --- a/src/main/java/com/vertexvis/model/CreateExportRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateExportRequestDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportRelationship; import com.vertexvis.model.ExportStateRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateExportRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateExportRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull private ExportRelationship source; public static final String SERIALIZED_NAME_STATE = "state"; @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable private ExportStateRelationship state; - public CreateExportRequestDataRelationships() { + public CreateExportRequestDataRelationships() { } - public CreateExportRequestDataRelationships source(ExportRelationship source) { - + public CreateExportRequestDataRelationships source(@javax.annotation.Nonnull ExportRelationship source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ExportRelationship getSource() { return source; } - - public void setSource(ExportRelationship source) { + public void setSource(@javax.annotation.Nonnull ExportRelationship source) { this.source = source; } - public CreateExportRequestDataRelationships state(ExportStateRelationship state) { - + public CreateExportRequestDataRelationships state(@javax.annotation.Nullable ExportStateRelationship state) { this.state = state; return this; } - /** + /** * Get state * @return state - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ExportStateRelationship getState() { return state; } - - public void setState(ExportStateRelationship state) { + public void setState(@javax.annotation.Nullable ExportStateRelationship state) { this.state = state; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + openapiFields.add("state"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateExportRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateExportRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateExportRequestDataRelationships is not found in the empty JSON string", CreateExportRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateExportRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateExportRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateExportRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `source` + ExportRelationship.validateJsonElement(jsonObj.get("source")); + // validate the optional field `state` + if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) { + ExportStateRelationship.validateJsonElement(jsonObj.get("state")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateExportRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateExportRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateExportRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateExportRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateExportRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateExportRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateExportRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateExportRequestDataRelationships + */ + public static CreateExportRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateExportRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateExportRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateFileRequest.java b/src/main/java/com/vertexvis/model/CreateFileRequest.java index 9b0fa29..843eea9 100644 --- a/src/main/java/com/vertexvis/model/CreateFileRequest.java +++ b/src/main/java/com/vertexvis/model/CreateFileRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateFileRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateFileRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateFileRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateFileRequestData data; - public CreateFileRequest() { + public CreateFileRequest() { } - public CreateFileRequest data(CreateFileRequestData data) { - + public CreateFileRequest data(@javax.annotation.Nonnull CreateFileRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateFileRequestData getData() { return data; } - - public void setData(CreateFileRequestData data) { + public void setData(@javax.annotation.Nonnull CreateFileRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFileRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFileRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFileRequest is not found in the empty JSON string", CreateFileRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFileRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFileRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFileRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateFileRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFileRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFileRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFileRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFileRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFileRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFileRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFileRequest + * @throws IOException if the JSON string is invalid with respect to CreateFileRequest + */ + public static CreateFileRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFileRequest.class); + } + + /** + * Convert an instance of CreateFileRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateFileRequestData.java b/src/main/java/com/vertexvis/model/CreateFileRequestData.java index 80fedc2..1f36a3b 100644 --- a/src/main/java/com/vertexvis/model/CreateFileRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateFileRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateFileRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateFileRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateFileRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateFileRequestDataAttributes attributes; - public CreateFileRequestData() { + public CreateFileRequestData() { } - public CreateFileRequestData type(String type) { - + public CreateFileRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "file", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateFileRequestData attributes(CreateFileRequestDataAttributes attributes) { - + public CreateFileRequestData attributes(@javax.annotation.Nonnull CreateFileRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateFileRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateFileRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateFileRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFileRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFileRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFileRequestData is not found in the empty JSON string", CreateFileRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFileRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFileRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFileRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateFileRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFileRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFileRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFileRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFileRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFileRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFileRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFileRequestData + * @throws IOException if the JSON string is invalid with respect to CreateFileRequestData + */ + public static CreateFileRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFileRequestData.class); + } + + /** + * Convert an instance of CreateFileRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateFileRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateFileRequestDataAttributes.java index 2bb1da3..27a37b8 100644 --- a/src/main/java/com/vertexvis/model/CreateFileRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateFileRequestDataAttributes.java @@ -14,105 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateFileRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateFileRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_ROOT_FILE_NAME = "rootFileName"; @SerializedName(SERIALIZED_NAME_ROOT_FILE_NAME) + @javax.annotation.Nullable private String rootFileName; - public CreateFileRequestDataAttributes() { + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + @SerializedName(SERIALIZED_NAME_EXPIRY) + @javax.annotation.Nullable + private Integer expiry; + + public CreateFileRequestDataAttributes() { } - public CreateFileRequestDataAttributes name(String name) { - + public CreateFileRequestDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Name matching that of the file you are uploading, including file extension. * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "model.zip", required = true, value = "Name matching that of the file you are uploading, including file extension.") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public CreateFileRequestDataAttributes suppliedId(String suppliedId) { - + public CreateFileRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public CreateFileRequestDataAttributes rootFileName(String rootFileName) { - + public CreateFileRequestDataAttributes rootFileName(@javax.annotation.Nullable String rootFileName) { this.rootFileName = rootFileName; return this; } - /** + /** * File name of the root part or assembly, including file extension. Required if `name` references an archive file extension, ignored otherwise. * @return rootFileName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "root-assembly.prt.1", value = "File name of the root part or assembly, including file extension. Required if `name` references an archive file extension, ignored otherwise.") - public String getRootFileName() { return rootFileName; } - - public void setRootFileName(String rootFileName) { + public void setRootFileName(@javax.annotation.Nullable String rootFileName) { this.rootFileName = rootFileName; } + public CreateFileRequestDataAttributes expiry(@javax.annotation.Nullable Integer expiry) { + this.expiry = expiry; + return this; + } + + /** + * Number of seconds before the file is deleted. + * minimum: 1 + * @return expiry + */ + @javax.annotation.Nullable + public Integer getExpiry() { + return expiry; + } + + public void setExpiry(@javax.annotation.Nullable Integer expiry) { + this.expiry = expiry; + } + + + @Override public boolean equals(Object o) { if (this == o) { @@ -124,12 +162,13 @@ public boolean equals(Object o) { CreateFileRequestDataAttributes createFileRequestDataAttributes = (CreateFileRequestDataAttributes) o; return Objects.equals(this.name, createFileRequestDataAttributes.name) && Objects.equals(this.suppliedId, createFileRequestDataAttributes.suppliedId) && - Objects.equals(this.rootFileName, createFileRequestDataAttributes.rootFileName); + Objects.equals(this.rootFileName, createFileRequestDataAttributes.rootFileName) && + Objects.equals(this.expiry, createFileRequestDataAttributes.expiry); } @Override public int hashCode() { - return Objects.hash(name, suppliedId, rootFileName); + return Objects.hash(name, suppliedId, rootFileName, expiry); } @Override @@ -139,6 +178,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); sb.append(" rootFileName: ").append(toIndentedString(rootFileName)).append("\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); sb.append("}"); return sb.toString(); } @@ -154,5 +194,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + openapiFields.add("rootFileName"); + openapiFields.add("expiry"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFileRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFileRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFileRequestDataAttributes is not found in the empty JSON string", CreateFileRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFileRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFileRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFileRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("rootFileName") != null && !jsonObj.get("rootFileName").isJsonNull()) && !jsonObj.get("rootFileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rootFileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rootFileName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFileRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFileRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFileRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFileRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFileRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFileRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFileRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateFileRequestDataAttributes + */ + public static CreateFileRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFileRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateFileRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateGeometrySetRequest.java b/src/main/java/com/vertexvis/model/CreateGeometrySetRequest.java index 39f0ccb..7579b53 100644 --- a/src/main/java/com/vertexvis/model/CreateGeometrySetRequest.java +++ b/src/main/java/com/vertexvis/model/CreateGeometrySetRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateGeometrySetRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateGeometrySetRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateGeometrySetRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateGeometrySetRequestData data; - public CreateGeometrySetRequest() { + public CreateGeometrySetRequest() { } - public CreateGeometrySetRequest data(CreateGeometrySetRequestData data) { - + public CreateGeometrySetRequest data(@javax.annotation.Nonnull CreateGeometrySetRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateGeometrySetRequestData getData() { return data; } - - public void setData(CreateGeometrySetRequestData data) { + public void setData(@javax.annotation.Nonnull CreateGeometrySetRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateGeometrySetRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateGeometrySetRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateGeometrySetRequest is not found in the empty JSON string", CreateGeometrySetRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateGeometrySetRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateGeometrySetRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateGeometrySetRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateGeometrySetRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateGeometrySetRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateGeometrySetRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateGeometrySetRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateGeometrySetRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateGeometrySetRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateGeometrySetRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateGeometrySetRequest + * @throws IOException if the JSON string is invalid with respect to CreateGeometrySetRequest + */ + public static CreateGeometrySetRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateGeometrySetRequest.class); + } + + /** + * Convert an instance of CreateGeometrySetRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateGeometrySetRequestData.java b/src/main/java/com/vertexvis/model/CreateGeometrySetRequestData.java index 1ab3c25..abeb8e2 100644 --- a/src/main/java/com/vertexvis/model/CreateGeometrySetRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateGeometrySetRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateGeometrySetRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateGeometrySetRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateGeometrySetRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateGeometrySetRequestDataRelationships relationships; - public CreateGeometrySetRequestData() { + public CreateGeometrySetRequestData() { } - public CreateGeometrySetRequestData type(String type) { - + public CreateGeometrySetRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "geometry-set", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateGeometrySetRequestData relationships(CreateGeometrySetRequestDataRelationships relationships) { - + public CreateGeometrySetRequestData relationships(@javax.annotation.Nonnull CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateGeometrySetRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateGeometrySetRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateGeometrySetRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateGeometrySetRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateGeometrySetRequestData is not found in the empty JSON string", CreateGeometrySetRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateGeometrySetRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateGeometrySetRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateGeometrySetRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `relationships` + CreateGeometrySetRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateGeometrySetRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateGeometrySetRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateGeometrySetRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateGeometrySetRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateGeometrySetRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateGeometrySetRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateGeometrySetRequestData + * @throws IOException if the JSON string is invalid with respect to CreateGeometrySetRequestData + */ + public static CreateGeometrySetRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateGeometrySetRequestData.class); + } + + /** + * Convert an instance of CreateGeometrySetRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateGeometrySetRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateGeometrySetRequestDataRelationships.java index ec5f0ba..3858eb1 100644 --- a/src/main/java/com/vertexvis/model/CreateGeometrySetRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateGeometrySetRequestDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.FileRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateGeometrySetRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateGeometrySetRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull private FileRelationship source; - public CreateGeometrySetRequestDataRelationships() { + public CreateGeometrySetRequestDataRelationships() { } - public CreateGeometrySetRequestDataRelationships source(FileRelationship source) { - + public CreateGeometrySetRequestDataRelationships source(@javax.annotation.Nonnull FileRelationship source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public FileRelationship getSource() { return source; } - - public void setSource(FileRelationship source) { + public void setSource(@javax.annotation.Nonnull FileRelationship source) { this.source = source; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateGeometrySetRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateGeometrySetRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateGeometrySetRequestDataRelationships is not found in the empty JSON string", CreateGeometrySetRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateGeometrySetRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateGeometrySetRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateGeometrySetRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `source` + FileRelationship.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateGeometrySetRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateGeometrySetRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateGeometrySetRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateGeometrySetRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateGeometrySetRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateGeometrySetRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateGeometrySetRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateGeometrySetRequestDataRelationships + */ + public static CreateGeometrySetRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateGeometrySetRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateGeometrySetRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateHitRequest.java b/src/main/java/com/vertexvis/model/CreateHitRequest.java index 33502dc..0661b1d 100644 --- a/src/main/java/com/vertexvis/model/CreateHitRequest.java +++ b/src/main/java/com/vertexvis/model/CreateHitRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateHitRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateHitRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateHitRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateHitRequestData data; - public CreateHitRequest() { + public CreateHitRequest() { } - public CreateHitRequest data(CreateHitRequestData data) { - + public CreateHitRequest data(@javax.annotation.Nonnull CreateHitRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateHitRequestData getData() { return data; } - - public void setData(CreateHitRequestData data) { + public void setData(@javax.annotation.Nonnull CreateHitRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateHitRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateHitRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateHitRequest is not found in the empty JSON string", CreateHitRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateHitRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateHitRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateHitRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateHitRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateHitRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateHitRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateHitRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateHitRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateHitRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateHitRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateHitRequest + * @throws IOException if the JSON string is invalid with respect to CreateHitRequest + */ + public static CreateHitRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateHitRequest.class); + } + + /** + * Convert an instance of CreateHitRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateHitRequestData.java b/src/main/java/com/vertexvis/model/CreateHitRequestData.java index b701e4a..e0c9a25 100644 --- a/src/main/java/com/vertexvis/model/CreateHitRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateHitRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateHitRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateHitRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateHitRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateHitRequestDataAttributes attributes; - public CreateHitRequestData() { + public CreateHitRequestData() { } - public CreateHitRequestData type(String type) { - + public CreateHitRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "hit", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateHitRequestData attributes(CreateHitRequestDataAttributes attributes) { - + public CreateHitRequestData attributes(@javax.annotation.Nonnull CreateHitRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateHitRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateHitRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateHitRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateHitRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateHitRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateHitRequestData is not found in the empty JSON string", CreateHitRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateHitRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateHitRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateHitRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateHitRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateHitRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateHitRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateHitRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateHitRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateHitRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateHitRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateHitRequestData + * @throws IOException if the JSON string is invalid with respect to CreateHitRequestData + */ + public static CreateHitRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateHitRequestData.class); + } + + /** + * Convert an instance of CreateHitRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateHitRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateHitRequestDataAttributes.java index 7ae8c78..04a25e0 100644 --- a/src/main/java/com/vertexvis/model/CreateHitRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateHitRequestDataAttributes.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Dimensions; import com.vertexvis.model.Point; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateHitRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateHitRequestDataAttributes { public static final String SERIALIZED_NAME_POINT = "point"; @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nonnull private Point point; public static final String SERIALIZED_NAME_VIEWPORT = "viewport"; @SerializedName(SERIALIZED_NAME_VIEWPORT) + @javax.annotation.Nonnull private Dimensions viewport; - public CreateHitRequestDataAttributes() { + public CreateHitRequestDataAttributes() { } - public CreateHitRequestDataAttributes point(Point point) { - + public CreateHitRequestDataAttributes point(@javax.annotation.Nonnull Point point) { this.point = point; return this; } - /** + /** * Get point * @return point - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Point getPoint() { return point; } - - public void setPoint(Point point) { + public void setPoint(@javax.annotation.Nonnull Point point) { this.point = point; } - public CreateHitRequestDataAttributes viewport(Dimensions viewport) { - + public CreateHitRequestDataAttributes viewport(@javax.annotation.Nonnull Dimensions viewport) { this.viewport = viewport; return this; } - /** + /** * Get viewport * @return viewport - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Dimensions getViewport() { return viewport; } - - public void setViewport(Dimensions viewport) { + public void setViewport(@javax.annotation.Nonnull Dimensions viewport) { this.viewport = viewport; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("point"); + openapiFields.add("viewport"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("point"); + openapiRequiredFields.add("viewport"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateHitRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateHitRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateHitRequestDataAttributes is not found in the empty JSON string", CreateHitRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateHitRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateHitRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateHitRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `point` + Point.validateJsonElement(jsonObj.get("point")); + // validate the required field `viewport` + Dimensions.validateJsonElement(jsonObj.get("viewport")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateHitRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateHitRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateHitRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateHitRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateHitRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateHitRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateHitRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateHitRequestDataAttributes + */ + public static CreateHitRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateHitRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateHitRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRenditionRequest.java b/src/main/java/com/vertexvis/model/CreatePartRenditionRequest.java index fca3e59..e94119e 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRenditionRequest.java +++ b/src/main/java/com/vertexvis/model/CreatePartRenditionRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreatePartRenditionRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatePartRenditionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRenditionRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreatePartRenditionRequestData data; - public CreatePartRenditionRequest() { + public CreatePartRenditionRequest() { } - public CreatePartRenditionRequest data(CreatePartRenditionRequestData data) { - + public CreatePartRenditionRequest data(@javax.annotation.Nonnull CreatePartRenditionRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatePartRenditionRequestData getData() { return data; } - - public void setData(CreatePartRenditionRequestData data) { + public void setData(@javax.annotation.Nonnull CreatePartRenditionRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRenditionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRenditionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRenditionRequest is not found in the empty JSON string", CreatePartRenditionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRenditionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRenditionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePartRenditionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreatePartRenditionRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRenditionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRenditionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRenditionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRenditionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRenditionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRenditionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRenditionRequest + * @throws IOException if the JSON string is invalid with respect to CreatePartRenditionRequest + */ + public static CreatePartRenditionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRenditionRequest.class); + } + + /** + * Convert an instance of CreatePartRenditionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRenditionRequestData.java b/src/main/java/com/vertexvis/model/CreatePartRenditionRequestData.java index 75be706..8bb2e9f 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRenditionRequestData.java +++ b/src/main/java/com/vertexvis/model/CreatePartRenditionRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,100 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateGeometrySetRequestDataRelationships; import com.vertexvis.model.CreatePartRenditionRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * Create a new part rendition. This endpoint includes multiple successful response codes: [`201`, `202`]. When not given a relationship, this endpoint will create a part rendition with an empty geometry and return a `201` status code. When given a relationship to translate, this endpoint will return a `202` status code with the location of a `queued-translation`. The status of the translation can be queried via `getQueuedTranslation`. After the translation is complete, the returned value will include a `part-rendition` that references the translated geometry. */ -@ApiModel(description = "Create a new part rendition. This endpoint includes multiple successful response codes: [`201`, `202`]. When not given a relationship, this endpoint will create a part rendition with an empty geometry and return a `201` status code. When given a relationship to translate, this endpoint will return a `202` status code with the location of a `queued-translation`. The status of the translation can be queried via `getQueuedTranslation`. After the translation is complete, the returned value will include a `part-rendition` that references the translated geometry. ") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRenditionRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreatePartRenditionRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private CreateGeometrySetRequestDataRelationships relationships; - public CreatePartRenditionRequestData() { + public CreatePartRenditionRequestData() { } - public CreatePartRenditionRequestData type(String type) { - + public CreatePartRenditionRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-rendition", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreatePartRenditionRequestData attributes(CreatePartRenditionRequestDataAttributes attributes) { - + public CreatePartRenditionRequestData attributes(@javax.annotation.Nonnull CreatePartRenditionRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatePartRenditionRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreatePartRenditionRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreatePartRenditionRequestDataAttributes attributes) { this.attributes = attributes; } - public CreatePartRenditionRequestData relationships(CreateGeometrySetRequestDataRelationships relationships) { - + public CreatePartRenditionRequestData relationships(@javax.annotation.Nullable CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CreateGeometrySetRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateGeometrySetRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -157,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRenditionRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRenditionRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRenditionRequestData is not found in the empty JSON string", CreatePartRenditionRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRenditionRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRenditionRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePartRenditionRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreatePartRenditionRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateGeometrySetRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRenditionRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRenditionRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRenditionRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRenditionRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRenditionRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRenditionRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRenditionRequestData + * @throws IOException if the JSON string is invalid with respect to CreatePartRenditionRequestData + */ + public static CreatePartRenditionRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRenditionRequestData.class); + } + + /** + * Convert an instance of CreatePartRenditionRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRenditionRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreatePartRenditionRequestDataAttributes.java index 66ac5a1..afcee6b 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRenditionRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreatePartRenditionRequestDataAttributes.java @@ -14,105 +14,118 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatePartRenditionRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRenditionRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_MAKE_DEFAULT = "makeDefault"; @SerializedName(SERIALIZED_NAME_MAKE_DEFAULT) + @javax.annotation.Nullable private Boolean makeDefault; - public CreatePartRenditionRequestDataAttributes() { + public CreatePartRenditionRequestDataAttributes() { } - public CreatePartRenditionRequestDataAttributes name(String name) { - + public CreatePartRenditionRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "1/2in. Washer (flat)", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public CreatePartRenditionRequestDataAttributes suppliedId(String suppliedId) { - + public CreatePartRenditionRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public CreatePartRenditionRequestDataAttributes makeDefault(Boolean makeDefault) { - + public CreatePartRenditionRequestDataAttributes makeDefault(@javax.annotation.Nullable Boolean makeDefault) { this.makeDefault = makeDefault; return this; } - /** + /** * Whether or not to replace the default rendition for the part revision with the newly created rendition. * @return makeDefault - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "false", value = "Whether or not to replace the default rendition for the part revision with the newly created rendition.") - public Boolean getMakeDefault() { return makeDefault; } - - public void setMakeDefault(Boolean makeDefault) { + public void setMakeDefault(@javax.annotation.Nullable Boolean makeDefault) { this.makeDefault = makeDefault; } + @Override public boolean equals(Object o) { if (this == o) { @@ -154,5 +167,97 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + openapiFields.add("makeDefault"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRenditionRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRenditionRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRenditionRequestDataAttributes is not found in the empty JSON string", CreatePartRenditionRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRenditionRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRenditionRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRenditionRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRenditionRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRenditionRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRenditionRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRenditionRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRenditionRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRenditionRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreatePartRenditionRequestDataAttributes + */ + public static CreatePartRenditionRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRenditionRequestDataAttributes.class); + } + + /** + * Convert an instance of CreatePartRenditionRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequest.java b/src/main/java/com/vertexvis/model/CreatePartRequest.java index 856fcaf..0cae6f4 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRequest.java +++ b/src/main/java/com/vertexvis/model/CreatePartRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreatePartRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatePartRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreatePartRequestData data; - public CreatePartRequest() { + public CreatePartRequest() { } - public CreatePartRequest data(CreatePartRequestData data) { - + public CreatePartRequest data(@javax.annotation.Nonnull CreatePartRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatePartRequestData getData() { return data; } - - public void setData(CreatePartRequestData data) { + public void setData(@javax.annotation.Nonnull CreatePartRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRequest is not found in the empty JSON string", CreatePartRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePartRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreatePartRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequest + * @throws IOException if the JSON string is invalid with respect to CreatePartRequest + */ + public static CreatePartRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequest.class); + } + + /** + * Convert an instance of CreatePartRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestData.java b/src/main/java/com/vertexvis/model/CreatePartRequestData.java index 7911d44..e770066 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRequestData.java +++ b/src/main/java/com/vertexvis/model/CreatePartRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreatePartRequestDataAttributes; import com.vertexvis.model.CreatePartRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreatePartRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreatePartRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private CreatePartRequestDataRelationships relationships; - public CreatePartRequestData() { + public CreatePartRequestData() { } - public CreatePartRequestData type(String type) { - + public CreatePartRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. Specify one and only one of suppliedId or suppliedIdKey and one and only one of suppliedRevisionId or suppliedRevisionIdKey. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part", required = true, value = "Resource object type. Specify one and only one of suppliedId or suppliedIdKey and one and only one of suppliedRevisionId or suppliedRevisionIdKey.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreatePartRequestData attributes(CreatePartRequestDataAttributes attributes) { - + public CreatePartRequestData attributes(@javax.annotation.Nonnull CreatePartRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatePartRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreatePartRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreatePartRequestDataAttributes attributes) { this.attributes = attributes; } - public CreatePartRequestData relationships(CreatePartRequestDataRelationships relationships) { - + public CreatePartRequestData relationships(@javax.annotation.Nullable CreatePartRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CreatePartRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreatePartRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable CreatePartRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRequestData is not found in the empty JSON string", CreatePartRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePartRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreatePartRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreatePartRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequestData + * @throws IOException if the JSON string is invalid with respect to CreatePartRequestData + */ + public static CreatePartRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequestData.class); + } + + /** + * Convert an instance of CreatePartRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java index eb15505..64020f6 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java @@ -14,140 +14,180 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatePartRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRequestDataAttributes { public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_SUPPLIED_REVISION_ID = "suppliedRevisionId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_REVISION_ID) + @javax.annotation.Nullable private String suppliedRevisionId; + public static final String SERIALIZED_NAME_SUPPLIED_ITERATION_ID = "suppliedIterationId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ITERATION_ID) + @javax.annotation.Nullable + private String suppliedIterationId; + public static final String SERIALIZED_NAME_INDEX_METADATA = "indexMetadata"; @SerializedName(SERIALIZED_NAME_INDEX_METADATA) + @javax.annotation.Nullable private Boolean indexMetadata; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_REVISION_NAME = "revisionName"; @SerializedName(SERIALIZED_NAME_REVISION_NAME) + @javax.annotation.Nullable private String revisionName; public static final String SERIALIZED_NAME_SUPPLIED_ID_KEY = "suppliedIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID_KEY) + @javax.annotation.Nullable private String suppliedIdKey; public static final String SERIALIZED_NAME_SUPPLIED_REVISION_ID_KEY = "suppliedRevisionIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_REVISION_ID_KEY) + @javax.annotation.Nullable private String suppliedRevisionIdKey; public static final String SERIALIZED_NAME_SUPPLIED_INSTANCE_ID_KEY = "suppliedInstanceIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_INSTANCE_ID_KEY) + @javax.annotation.Nullable private String suppliedInstanceIdKey; - public CreatePartRequestDataAttributes() { + public CreatePartRequestDataAttributes() { } - public CreatePartRequestDataAttributes suppliedId(String suppliedId) { - + public CreatePartRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system. ") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public CreatePartRequestDataAttributes suppliedRevisionId(String suppliedRevisionId) { - + public CreatePartRequestDataAttributes suppliedRevisionId(@javax.annotation.Nullable String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. Sending a new suppliedRevisionId combined with an existing suppliedId will create a new part revision for an existing part. * @return suppliedRevisionId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "RevA", value = "ID provided for correlation. For example, an existing ID from a PLM system. Sending a new suppliedRevisionId combined with an existing suppliedId will create a new part revision for an existing part. ") - public String getSuppliedRevisionId() { return suppliedRevisionId; } - - public void setSuppliedRevisionId(String suppliedRevisionId) { + public void setSuppliedRevisionId(@javax.annotation.Nullable String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; } - public CreatePartRequestDataAttributes indexMetadata(Boolean indexMetadata) { - + public CreatePartRequestDataAttributes suppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + return this; + } + + /** + * ID provided for correlation of the revision. This is an optional ID to be able to create a version of a revision. For example, if and existing revision in a PLM system is modified, the suppliedIterationId can be used to allow creating a new part revision having an already existing suppliedId and suppliedRevisionId. This can be used when modification to an existing revision is made in the PLM system before the revision is released. + * @return suppliedIterationId + */ + @javax.annotation.Nullable + public String getSuppliedIterationId() { + return suppliedIterationId; + } + + public void setSuppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + } + + + public CreatePartRequestDataAttributes indexMetadata(@javax.annotation.Nullable Boolean indexMetadata) { this.indexMetadata = indexMetadata; return this; } - /** + /** * Whether or not to index metadata in the part file. To ignore metadata from the part file and add your own, pass `false` for `indexMetadata` and supply custom metadata using the `metadata` field. * @return indexMetadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "false", value = "Whether or not to index metadata in the part file. To ignore metadata from the part file and add your own, pass `false` for `indexMetadata` and supply custom metadata using the `metadata` field. ") - public Boolean getIndexMetadata() { return indexMetadata; } - - public void setIndexMetadata(Boolean indexMetadata) { + public void setIndexMetadata(@javax.annotation.Nullable Boolean indexMetadata) { this.indexMetadata = indexMetadata; } - public CreatePartRequestDataAttributes metadata(Map metadata) { - + public CreatePartRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public CreatePartRequestDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public CreatePartRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -155,138 +195,116 @@ public CreatePartRequestDataAttributes putMetadataItem(String key, AnyOfMetadata return this; } - /** + /** * Additional metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Additional metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. ") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } - public CreatePartRequestDataAttributes name(String name) { - + public CreatePartRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Name to be used for the root part. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "1/2in. Flat Washer", value = "Name to be used for the root part.") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public CreatePartRequestDataAttributes revisionName(String revisionName) { - + public CreatePartRequestDataAttributes revisionName(@javax.annotation.Nullable String revisionName) { this.revisionName = revisionName; return this; } - /** + /** * Optional name to be used for the part revision. * @return revisionName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "1/2in. Flat Washer - A", value = "Optional name to be used for the part revision.") - public String getRevisionName() { return revisionName; } - - public void setRevisionName(String revisionName) { + public void setRevisionName(@javax.annotation.Nullable String revisionName) { this.revisionName = revisionName; } - public CreatePartRequestDataAttributes suppliedIdKey(String suppliedIdKey) { - + public CreatePartRequestDataAttributes suppliedIdKey(@javax.annotation.Nullable String suppliedIdKey) { this.suppliedIdKey = suppliedIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. * @return suppliedIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "ProductNumber", value = "Metadata key used to extract an ID used for correlation.") - public String getSuppliedIdKey() { return suppliedIdKey; } - - public void setSuppliedIdKey(String suppliedIdKey) { + public void setSuppliedIdKey(@javax.annotation.Nullable String suppliedIdKey) { this.suppliedIdKey = suppliedIdKey; } - public CreatePartRequestDataAttributes suppliedRevisionIdKey(String suppliedRevisionIdKey) { - + public CreatePartRequestDataAttributes suppliedRevisionIdKey(@javax.annotation.Nullable String suppliedRevisionIdKey) { this.suppliedRevisionIdKey = suppliedRevisionIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. * @return suppliedRevisionIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "RevisionId", value = "Metadata key used to extract an ID used for correlation.") - public String getSuppliedRevisionIdKey() { return suppliedRevisionIdKey; } - - public void setSuppliedRevisionIdKey(String suppliedRevisionIdKey) { + public void setSuppliedRevisionIdKey(@javax.annotation.Nullable String suppliedRevisionIdKey) { this.suppliedRevisionIdKey = suppliedRevisionIdKey; } - public CreatePartRequestDataAttributes suppliedInstanceIdKey(String suppliedInstanceIdKey) { - + public CreatePartRequestDataAttributes suppliedInstanceIdKey(@javax.annotation.Nullable String suppliedInstanceIdKey) { this.suppliedInstanceIdKey = suppliedInstanceIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. * @return suppliedInstanceIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "InstanceId", value = "Metadata key used to extract an ID used for correlation.") - public String getSuppliedInstanceIdKey() { return suppliedInstanceIdKey; } - - public void setSuppliedInstanceIdKey(String suppliedInstanceIdKey) { + public void setSuppliedInstanceIdKey(@javax.annotation.Nullable String suppliedInstanceIdKey) { this.suppliedInstanceIdKey = suppliedInstanceIdKey; } + @Override public boolean equals(Object o) { if (this == o) { @@ -298,6 +316,7 @@ public boolean equals(Object o) { CreatePartRequestDataAttributes createPartRequestDataAttributes = (CreatePartRequestDataAttributes) o; return Objects.equals(this.suppliedId, createPartRequestDataAttributes.suppliedId) && Objects.equals(this.suppliedRevisionId, createPartRequestDataAttributes.suppliedRevisionId) && + Objects.equals(this.suppliedIterationId, createPartRequestDataAttributes.suppliedIterationId) && Objects.equals(this.indexMetadata, createPartRequestDataAttributes.indexMetadata) && Objects.equals(this.metadata, createPartRequestDataAttributes.metadata) && Objects.equals(this.name, createPartRequestDataAttributes.name) && @@ -309,7 +328,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(suppliedId, suppliedRevisionId, indexMetadata, metadata, name, revisionName, suppliedIdKey, suppliedRevisionIdKey, suppliedInstanceIdKey); + return Objects.hash(suppliedId, suppliedRevisionId, suppliedIterationId, indexMetadata, metadata, name, revisionName, suppliedIdKey, suppliedRevisionIdKey, suppliedInstanceIdKey); } @Override @@ -318,6 +337,7 @@ public String toString() { sb.append("class CreatePartRequestDataAttributes {\n"); sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); sb.append(" suppliedRevisionId: ").append(toIndentedString(suppliedRevisionId)).append("\n"); + sb.append(" suppliedIterationId: ").append(toIndentedString(suppliedIterationId)).append("\n"); sb.append(" indexMetadata: ").append(toIndentedString(indexMetadata)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); @@ -340,5 +360,122 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("suppliedId"); + openapiFields.add("suppliedRevisionId"); + openapiFields.add("suppliedIterationId"); + openapiFields.add("indexMetadata"); + openapiFields.add("metadata"); + openapiFields.add("name"); + openapiFields.add("revisionName"); + openapiFields.add("suppliedIdKey"); + openapiFields.add("suppliedRevisionIdKey"); + openapiFields.add("suppliedInstanceIdKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRequestDataAttributes is not found in the empty JSON string", CreatePartRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("suppliedRevisionId") != null && !jsonObj.get("suppliedRevisionId").isJsonNull()) && !jsonObj.get("suppliedRevisionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedRevisionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedRevisionId").toString())); + } + if ((jsonObj.get("suppliedIterationId") != null && !jsonObj.get("suppliedIterationId").isJsonNull()) && !jsonObj.get("suppliedIterationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedIterationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedIterationId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("revisionName") != null && !jsonObj.get("revisionName").isJsonNull()) && !jsonObj.get("revisionName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revisionName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revisionName").toString())); + } + if ((jsonObj.get("suppliedIdKey") != null && !jsonObj.get("suppliedIdKey").isJsonNull()) && !jsonObj.get("suppliedIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedIdKey").toString())); + } + if ((jsonObj.get("suppliedRevisionIdKey") != null && !jsonObj.get("suppliedRevisionIdKey").isJsonNull()) && !jsonObj.get("suppliedRevisionIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedRevisionIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedRevisionIdKey").toString())); + } + if ((jsonObj.get("suppliedInstanceIdKey") != null && !jsonObj.get("suppliedInstanceIdKey").isJsonNull()) && !jsonObj.get("suppliedInstanceIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedInstanceIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedInstanceIdKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreatePartRequestDataAttributes + */ + public static CreatePartRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequestDataAttributes.class); + } + + /** + * Convert an instance of CreatePartRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java index e521dbd..4095b72 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java @@ -14,51 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.CreatePartRequestDataRelationshipsSource; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatePartRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatePartRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) - private AnyOfFileRelationshipPartAssemblyRelationship source; + @javax.annotation.Nonnull + private CreatePartRequestDataRelationshipsSource source; - public CreatePartRequestDataRelationships() { + public CreatePartRequestDataRelationships() { } - public CreatePartRequestDataRelationships source(AnyOfFileRelationshipPartAssemblyRelationship source) { - + public CreatePartRequestDataRelationships source(@javax.annotation.Nonnull CreatePartRequestDataRelationshipsSource source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "") - - public AnyOfFileRelationshipPartAssemblyRelationship getSource() { + */ + @javax.annotation.Nonnull + public CreatePartRequestDataRelationshipsSource getSource() { return source; } - - public void setSource(AnyOfFileRelationshipPartAssemblyRelationship source) { + public void setSource(@javax.annotation.Nonnull CreatePartRequestDataRelationshipsSource source) { this.source = source; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePartRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePartRequestDataRelationships is not found in the empty JSON string", CreatePartRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePartRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePartRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePartRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `source` + CreatePartRequestDataRelationshipsSource.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePartRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePartRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePartRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreatePartRequestDataRelationships + */ + public static CreatePartRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequestDataRelationships.class); + } + + /** + * Convert an instance of CreatePartRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java new file mode 100644 index 0000000..a0dbe4c --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java @@ -0,0 +1,268 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.FileRelationship; +import com.vertexvis.model.PartAssemblyRelationship; +import com.vertexvis.model.PartAssemblyRelationshipData; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreatePartRequestDataRelationshipsSource extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreatePartRequestDataRelationshipsSource.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequestDataRelationshipsSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequestDataRelationshipsSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterFileRelationship = gson.getDelegateAdapter(this, TypeToken.get(FileRelationship.class)); + final TypeAdapter adapterPartAssemblyRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartAssemblyRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequestDataRelationshipsSource value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `FileRelationship` + if (value.getActualInstance() instanceof FileRelationship) { + JsonElement element = adapterFileRelationship.toJsonTree((FileRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartAssemblyRelationship` + if (value.getActualInstance() instanceof PartAssemblyRelationship) { + JsonElement element = adapterPartAssemblyRelationship.toJsonTree((PartAssemblyRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: FileRelationship, PartAssemblyRelationship"); + } + + @Override + public CreatePartRequestDataRelationshipsSource read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize FileRelationship + try { + // validate the JSON object to see if any exception is thrown + FileRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterFileRelationship; + CreatePartRequestDataRelationshipsSource ret = new CreatePartRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for FileRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'FileRelationship'", e); + } + // deserialize PartAssemblyRelationship + try { + // validate the JSON object to see if any exception is thrown + PartAssemblyRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartAssemblyRelationship; + CreatePartRequestDataRelationshipsSource ret = new CreatePartRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartAssemblyRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartAssemblyRelationship'", e); + } + + throw new IOException(String.format("Failed deserialization for CreatePartRequestDataRelationshipsSource: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public CreatePartRequestDataRelationshipsSource() { + super("anyOf", Boolean.FALSE); + } + + public CreatePartRequestDataRelationshipsSource(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("FileRelationship", FileRelationship.class); + schemas.put("PartAssemblyRelationship", PartAssemblyRelationship.class); + } + + @Override + public Map> getSchemas() { + return CreatePartRequestDataRelationshipsSource.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * FileRelationship, PartAssemblyRelationship + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof FileRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartAssemblyRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be FileRelationship, PartAssemblyRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * FileRelationship, PartAssemblyRelationship + * + * @return The actual instance (FileRelationship, PartAssemblyRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `FileRelationship`. If the actual instance is not `FileRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `FileRelationship` + * @throws ClassCastException if the instance is not `FileRelationship` + */ + public FileRelationship getFileRelationship() throws ClassCastException { + return (FileRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartAssemblyRelationship`. If the actual instance is not `PartAssemblyRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartAssemblyRelationship` + * @throws ClassCastException if the instance is not `PartAssemblyRelationship` + */ + public PartAssemblyRelationship getPartAssemblyRelationship() throws ClassCastException { + return (PartAssemblyRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequestDataRelationshipsSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with FileRelationship + try { + FileRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for FileRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartAssemblyRelationship + try { + PartAssemblyRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartAssemblyRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for CreatePartRequestDataRelationshipsSource with anyOf schemas: FileRelationship, PartAssemblyRelationship. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of CreatePartRequestDataRelationshipsSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequestDataRelationshipsSource + * @throws IOException if the JSON string is invalid with respect to CreatePartRequestDataRelationshipsSource + */ + public static CreatePartRequestDataRelationshipsSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequestDataRelationshipsSource.class); + } + + /** + * Convert an instance of CreatePartRequestDataRelationshipsSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java index 7142fe8..941c78c 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneAlterationRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneAlterationRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneAlterationRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneAlterationRequestData data; - public CreateSceneAlterationRequest() { + public CreateSceneAlterationRequest() { } - public CreateSceneAlterationRequest data(CreateSceneAlterationRequestData data) { - + public CreateSceneAlterationRequest data(@javax.annotation.Nonnull CreateSceneAlterationRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneAlterationRequestData getData() { return data; } - - public void setData(CreateSceneAlterationRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneAlterationRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAlterationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAlterationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAlterationRequest is not found in the empty JSON string", CreateSceneAlterationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAlterationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAlterationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAlterationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneAlterationRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAlterationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAlterationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAlterationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAlterationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAlterationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAlterationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAlterationRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneAlterationRequest + */ + public static CreateSceneAlterationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAlterationRequest.class); + } + + /** + * Convert an instance of CreateSceneAlterationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestData.java index 719c0af..43ef9b2 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneAlterationRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneAlterationRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneAlterationRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneAlterationRequestDataAttributes attributes; - public CreateSceneAlterationRequestData() { + public CreateSceneAlterationRequestData() { } - public CreateSceneAlterationRequestData type(String type) { - + public CreateSceneAlterationRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-alteration", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneAlterationRequestData attributes(CreateSceneAlterationRequestDataAttributes attributes) { - + public CreateSceneAlterationRequestData attributes(@javax.annotation.Nonnull CreateSceneAlterationRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneAlterationRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneAlterationRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneAlterationRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAlterationRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAlterationRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAlterationRequestData is not found in the empty JSON string", CreateSceneAlterationRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAlterationRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAlterationRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAlterationRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneAlterationRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAlterationRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAlterationRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAlterationRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAlterationRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAlterationRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAlterationRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAlterationRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneAlterationRequestData + */ + public static CreateSceneAlterationRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAlterationRequestData.class); + } + + /** + * Convert an instance of CreateSceneAlterationRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestDataAttributes.java index cb7a576..c432f86 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneAlterationRequestDataAttributes.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneOperation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneAlterationRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneAlterationRequestDataAttributes { public static final String SERIALIZED_NAME_ALTERATIONS = "alterations"; @SerializedName(SERIALIZED_NAME_ALTERATIONS) + @javax.annotation.Nonnull private List alterations = new ArrayList<>(); - public CreateSceneAlterationRequestDataAttributes() { + public CreateSceneAlterationRequestDataAttributes() { } - public CreateSceneAlterationRequestDataAttributes alterations(List alterations) { - + public CreateSceneAlterationRequestDataAttributes alterations(@javax.annotation.Nonnull List alterations) { this.alterations = alterations; return this; } public CreateSceneAlterationRequestDataAttributes addAlterationsItem(SceneOperation alterationsItem) { + if (this.alterations == null) { + this.alterations = new ArrayList<>(); + } this.alterations.add(alterationsItem); return this; } - /** + /** * List of alterations to apply. * @return alterations - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "List of alterations to apply.") - public List getAlterations() { return alterations; } - - public void setAlterations(List alterations) { + public void setAlterations(@javax.annotation.Nonnull List alterations) { this.alterations = alterations; } + @Override public boolean equals(Object o) { if (this == o) { @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("alterations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("alterations"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAlterationRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAlterationRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAlterationRequestDataAttributes is not found in the empty JSON string", CreateSceneAlterationRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAlterationRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAlterationRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAlterationRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("alterations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `alterations` to be an array in the JSON string but got `%s`", jsonObj.get("alterations").toString())); + } + + JsonArray jsonArrayalterations = jsonObj.getAsJsonArray("alterations"); + // validate the required field `alterations` (array) + for (int i = 0; i < jsonArrayalterations.size(); i++) { + SceneOperation.validateJsonElement(jsonArrayalterations.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAlterationRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAlterationRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAlterationRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAlterationRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAlterationRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAlterationRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAlterationRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneAlterationRequestDataAttributes + */ + public static CreateSceneAlterationRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAlterationRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneAlterationRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequest.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequest.java new file mode 100644 index 0000000..956d1b4 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequest.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private CreateSceneAnnotationRequestData data; + + public CreateSceneAnnotationRequest() { + } + + public CreateSceneAnnotationRequest data(@javax.annotation.Nonnull CreateSceneAnnotationRequestData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationRequestData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull CreateSceneAnnotationRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationRequest createSceneAnnotationRequest = (CreateSceneAnnotationRequest) o; + return Objects.equals(this.data, createSceneAnnotationRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationRequest is not found in the empty JSON string", CreateSceneAnnotationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAnnotationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneAnnotationRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationRequest + */ + public static CreateSceneAnnotationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationRequest.class); + } + + /** + * Convert an instance of CreateSceneAnnotationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestData.java new file mode 100644 index 0000000..32ceb74 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestData.java @@ -0,0 +1,245 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationRequestDataAttributes; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private CreateSceneAnnotationRequestDataAttributes attributes; + + public CreateSceneAnnotationRequestData() { + } + + public CreateSceneAnnotationRequestData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public CreateSceneAnnotationRequestData attributes(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationRequestData createSceneAnnotationRequestData = (CreateSceneAnnotationRequestData) o; + return Objects.equals(this.type, createSceneAnnotationRequestData.type) && + Objects.equals(this.attributes, createSceneAnnotationRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationRequestData is not found in the empty JSON string", CreateSceneAnnotationRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAnnotationRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneAnnotationRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationRequestData + */ + public static CreateSceneAnnotationRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationRequestData.class); + } + + /** + * Convert an instance of CreateSceneAnnotationRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributes.java new file mode 100644 index 0000000..f5f9577 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributes.java @@ -0,0 +1,244 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationRequestDataAttributes { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private CreateSceneAnnotationRequestDataAttributesData data; + + public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable + private String suppliedId; + + public CreateSceneAnnotationRequestDataAttributes() { + } + + public CreateSceneAnnotationRequestDataAttributes data(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationRequestDataAttributesData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + } + + + public CreateSceneAnnotationRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + return this; + } + + /** + * A customer provided ID used for correlation. + * @return suppliedId + */ + @javax.annotation.Nullable + public String getSuppliedId() { + return suppliedId; + } + + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationRequestDataAttributes createSceneAnnotationRequestDataAttributes = (CreateSceneAnnotationRequestDataAttributes) o; + return Objects.equals(this.data, createSceneAnnotationRequestDataAttributes.data) && + Objects.equals(this.suppliedId, createSceneAnnotationRequestDataAttributes.suppliedId); + } + + @Override + public int hashCode() { + return Objects.hash(data, suppliedId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationRequestDataAttributes {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationRequestDataAttributes is not found in the empty JSON string", CreateSceneAnnotationRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAnnotationRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneAnnotationRequestDataAttributesData.validateJsonElement(jsonObj.get("data")); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationRequestDataAttributes + */ + public static CreateSceneAnnotationRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneAnnotationRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributesData.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributesData.java new file mode 100644 index 0000000..ca59aa4 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationRequestDataAttributesData.java @@ -0,0 +1,276 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.SceneAnnotationCalloutDataType; +import com.vertexvis.model.SceneAnnotationCustomDataType; +import com.vertexvis.model.Vector3; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationRequestDataAttributesData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateSceneAnnotationRequestDataAttributesData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationRequestDataAttributesData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationRequestDataAttributesData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterSceneAnnotationCalloutDataType = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationCalloutDataType.class)); + final TypeAdapter adapterSceneAnnotationCustomDataType = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationCustomDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationRequestDataAttributesData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `SceneAnnotationCalloutDataType` + if (value.getActualInstance() instanceof SceneAnnotationCalloutDataType) { + JsonElement element = adapterSceneAnnotationCalloutDataType.toJsonTree((SceneAnnotationCalloutDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneAnnotationCustomDataType` + if (value.getActualInstance() instanceof SceneAnnotationCustomDataType) { + JsonElement element = adapterSceneAnnotationCustomDataType.toJsonTree((SceneAnnotationCustomDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType"); + } + + @Override + public CreateSceneAnnotationRequestDataAttributesData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize SceneAnnotationCalloutDataType + try { + // validate the JSON object to see if any exception is thrown + SceneAnnotationCalloutDataType.validateJsonElement(jsonElement); + actualAdapter = adapterSceneAnnotationCalloutDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneAnnotationCalloutDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneAnnotationCalloutDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneAnnotationCalloutDataType'", e); + } + // deserialize SceneAnnotationCustomDataType + try { + // validate the JSON object to see if any exception is thrown + SceneAnnotationCustomDataType.validateJsonElement(jsonElement); + actualAdapter = adapterSceneAnnotationCustomDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneAnnotationCustomDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneAnnotationCustomDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneAnnotationCustomDataType'", e); + } + + if (match == 1) { + CreateSceneAnnotationRequestDataAttributesData ret = new CreateSceneAnnotationRequestDataAttributesData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateSceneAnnotationRequestDataAttributesData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateSceneAnnotationRequestDataAttributesData() { + super("oneOf", Boolean.FALSE); + } + + public CreateSceneAnnotationRequestDataAttributesData(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SceneAnnotationCalloutDataType", SceneAnnotationCalloutDataType.class); + schemas.put("SceneAnnotationCustomDataType", SceneAnnotationCustomDataType.class); + } + + @Override + public Map> getSchemas() { + return CreateSceneAnnotationRequestDataAttributesData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof SceneAnnotationCalloutDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneAnnotationCustomDataType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType"); + } + + /** + * Get the actual instance, which can be the following: + * SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType + * + * @return The actual instance (SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneAnnotationCalloutDataType`. If the actual instance is not `SceneAnnotationCalloutDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneAnnotationCalloutDataType` + * @throws ClassCastException if the instance is not `SceneAnnotationCalloutDataType` + */ + public SceneAnnotationCalloutDataType getSceneAnnotationCalloutDataType() throws ClassCastException { + return (SceneAnnotationCalloutDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneAnnotationCustomDataType`. If the actual instance is not `SceneAnnotationCustomDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneAnnotationCustomDataType` + * @throws ClassCastException if the instance is not `SceneAnnotationCustomDataType` + */ + public SceneAnnotationCustomDataType getSceneAnnotationCustomDataType() throws ClassCastException { + return (SceneAnnotationCustomDataType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationRequestDataAttributesData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with SceneAnnotationCalloutDataType + try { + SceneAnnotationCalloutDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneAnnotationCalloutDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneAnnotationCustomDataType + try { + SceneAnnotationCustomDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneAnnotationCustomDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateSceneAnnotationRequestDataAttributesData with oneOf schemas: SceneAnnotationCalloutDataType, SceneAnnotationCustomDataType. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateSceneAnnotationRequestDataAttributesData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationRequestDataAttributesData + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationRequestDataAttributesData + */ + public static CreateSceneAnnotationRequestDataAttributesData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationRequestDataAttributesData.class); + } + + /** + * Convert an instance of CreateSceneAnnotationRequestDataAttributesData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequest.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequest.java new file mode 100644 index 0000000..177ab54 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequest.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationSetRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationSetRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationSetRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private CreateSceneAnnotationSetRequestData data; + + public CreateSceneAnnotationSetRequest() { + } + + public CreateSceneAnnotationSetRequest data(@javax.annotation.Nonnull CreateSceneAnnotationSetRequestData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationSetRequestData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull CreateSceneAnnotationSetRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationSetRequest createSceneAnnotationSetRequest = (CreateSceneAnnotationSetRequest) o; + return Objects.equals(this.data, createSceneAnnotationSetRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationSetRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationSetRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationSetRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationSetRequest is not found in the empty JSON string", CreateSceneAnnotationSetRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationSetRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationSetRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAnnotationSetRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneAnnotationSetRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationSetRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationSetRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationSetRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationSetRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationSetRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationSetRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationSetRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationSetRequest + */ + public static CreateSceneAnnotationSetRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationSetRequest.class); + } + + /** + * Convert an instance of CreateSceneAnnotationSetRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestData.java new file mode 100644 index 0000000..364d334 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestData.java @@ -0,0 +1,245 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationSetRequestDataAttributes; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationSetRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationSetRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private CreateSceneAnnotationSetRequestDataAttributes attributes; + + public CreateSceneAnnotationSetRequestData() { + } + + public CreateSceneAnnotationSetRequestData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public CreateSceneAnnotationSetRequestData attributes(@javax.annotation.Nonnull CreateSceneAnnotationSetRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationSetRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull CreateSceneAnnotationSetRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationSetRequestData createSceneAnnotationSetRequestData = (CreateSceneAnnotationSetRequestData) o; + return Objects.equals(this.type, createSceneAnnotationSetRequestData.type) && + Objects.equals(this.attributes, createSceneAnnotationSetRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationSetRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationSetRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationSetRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationSetRequestData is not found in the empty JSON string", CreateSceneAnnotationSetRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationSetRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationSetRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneAnnotationSetRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneAnnotationSetRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationSetRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationSetRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationSetRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationSetRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationSetRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationSetRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationSetRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationSetRequestData + */ + public static CreateSceneAnnotationSetRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationSetRequestData.class); + } + + /** + * Convert an instance of CreateSceneAnnotationSetRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestDataAttributes.java new file mode 100644 index 0000000..1ede45e --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneAnnotationSetRequestDataAttributes.java @@ -0,0 +1,236 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * CreateSceneAnnotationSetRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneAnnotationSetRequestDataAttributes { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable + private String suppliedId; + + public CreateSceneAnnotationSetRequestDataAttributes() { + } + + public CreateSceneAnnotationSetRequestDataAttributes name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CreateSceneAnnotationSetRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + return this; + } + + /** + * A customer provided ID used for correlation. + * @return suppliedId + */ + @javax.annotation.Nullable + public String getSuppliedId() { + return suppliedId; + } + + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSceneAnnotationSetRequestDataAttributes createSceneAnnotationSetRequestDataAttributes = (CreateSceneAnnotationSetRequestDataAttributes) o; + return Objects.equals(this.name, createSceneAnnotationSetRequestDataAttributes.name) && + Objects.equals(this.suppliedId, createSceneAnnotationSetRequestDataAttributes.suppliedId); + } + + @Override + public int hashCode() { + return Objects.hash(name, suppliedId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSceneAnnotationSetRequestDataAttributes {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneAnnotationSetRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneAnnotationSetRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneAnnotationSetRequestDataAttributes is not found in the empty JSON string", CreateSceneAnnotationSetRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneAnnotationSetRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneAnnotationSetRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneAnnotationSetRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneAnnotationSetRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneAnnotationSetRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneAnnotationSetRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneAnnotationSetRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneAnnotationSetRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneAnnotationSetRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneAnnotationSetRequestDataAttributes + */ + public static CreateSceneAnnotationSetRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneAnnotationSetRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneAnnotationSetRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequest.java b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequest.java index eb3303f..3767925 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneItemOverrideRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemOverrideRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemOverrideRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneItemOverrideRequestData data; - public CreateSceneItemOverrideRequest() { + public CreateSceneItemOverrideRequest() { } - public CreateSceneItemOverrideRequest data(CreateSceneItemOverrideRequestData data) { - + public CreateSceneItemOverrideRequest data(@javax.annotation.Nonnull CreateSceneItemOverrideRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemOverrideRequestData getData() { return data; } - - public void setData(CreateSceneItemOverrideRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneItemOverrideRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemOverrideRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemOverrideRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemOverrideRequest is not found in the empty JSON string", CreateSceneItemOverrideRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemOverrideRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemOverrideRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneItemOverrideRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneItemOverrideRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemOverrideRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemOverrideRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemOverrideRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemOverrideRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemOverrideRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemOverrideRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemOverrideRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemOverrideRequest + */ + public static CreateSceneItemOverrideRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemOverrideRequest.class); + } + + /** + * Convert an instance of CreateSceneItemOverrideRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestData.java index 853e9bc..843e9cd 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneItemOverrideRequestDataAttributes; import com.vertexvis.model.CreateSceneItemOverrideRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneItemOverrideRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemOverrideRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneItemOverrideRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateSceneItemOverrideRequestDataRelationships relationships; - public CreateSceneItemOverrideRequestData() { + public CreateSceneItemOverrideRequestData() { } - public CreateSceneItemOverrideRequestData type(String type) { - + public CreateSceneItemOverrideRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item-override", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneItemOverrideRequestData attributes(CreateSceneItemOverrideRequestDataAttributes attributes) { - + public CreateSceneItemOverrideRequestData attributes(@javax.annotation.Nonnull CreateSceneItemOverrideRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemOverrideRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneItemOverrideRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneItemOverrideRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateSceneItemOverrideRequestData relationships(CreateSceneItemOverrideRequestDataRelationships relationships) { - + public CreateSceneItemOverrideRequestData relationships(@javax.annotation.Nonnull CreateSceneItemOverrideRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemOverrideRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateSceneItemOverrideRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateSceneItemOverrideRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemOverrideRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemOverrideRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemOverrideRequestData is not found in the empty JSON string", CreateSceneItemOverrideRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemOverrideRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemOverrideRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneItemOverrideRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneItemOverrideRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateSceneItemOverrideRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemOverrideRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemOverrideRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemOverrideRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemOverrideRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemOverrideRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemOverrideRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemOverrideRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemOverrideRequestData + */ + public static CreateSceneItemOverrideRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemOverrideRequestData.class); + } + + /** + * Convert an instance of CreateSceneItemOverrideRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataAttributes.java index ccb9ede..5939390 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataAttributes.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,180 +21,185 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterial; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemOverrideRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemOverrideRequestDataAttributes { public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; public static final String SERIALIZED_NAME_MATERIAL = "material"; @SerializedName(SERIALIZED_NAME_MATERIAL) + @javax.annotation.Nullable private ColorMaterial material; public static final String SERIALIZED_NAME_SELECTED = "selected"; @SerializedName(SERIALIZED_NAME_SELECTED) + @javax.annotation.Nullable private Boolean selected; public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; - public CreateSceneItemOverrideRequestDataAttributes() { + public CreateSceneItemOverrideRequestDataAttributes() { } - public CreateSceneItemOverrideRequestDataAttributes visible(Boolean visible) { - + public CreateSceneItemOverrideRequestDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Item visibility. * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Item visibility.") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public CreateSceneItemOverrideRequestDataAttributes transform(Matrix4 transform) { - + public CreateSceneItemOverrideRequestDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } - public CreateSceneItemOverrideRequestDataAttributes material(ColorMaterial material) { - + public CreateSceneItemOverrideRequestDataAttributes material(@javax.annotation.Nullable ColorMaterial material) { this.material = material; return this; } - /** + /** * Get material * @return material - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterial getMaterial() { return material; } - - public void setMaterial(ColorMaterial material) { + public void setMaterial(@javax.annotation.Nullable ColorMaterial material) { this.material = material; } - public CreateSceneItemOverrideRequestDataAttributes selected(Boolean selected) { - + public CreateSceneItemOverrideRequestDataAttributes selected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; return this; } - /** + /** * Get selected * @return selected - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getSelected() { return selected; } - - public void setSelected(Boolean selected) { + public void setSelected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; } - public CreateSceneItemOverrideRequestDataAttributes phantom(Boolean phantom) { - + public CreateSceneItemOverrideRequestDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Phantom state of the item. * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Phantom state of the item.") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public CreateSceneItemOverrideRequestDataAttributes endItem(Boolean endItem) { - + public CreateSceneItemOverrideRequestDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Whether this item is an end item. * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this item is an end item.") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -243,5 +247,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("visible"); + openapiFields.add("transform"); + openapiFields.add("material"); + openapiFields.add("selected"); + openapiFields.add("phantom"); + openapiFields.add("endItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemOverrideRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemOverrideRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemOverrideRequestDataAttributes is not found in the empty JSON string", CreateSceneItemOverrideRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemOverrideRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemOverrideRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + // validate the optional field `material` + if (jsonObj.get("material") != null && !jsonObj.get("material").isJsonNull()) { + ColorMaterial.validateJsonElement(jsonObj.get("material")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemOverrideRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemOverrideRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemOverrideRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemOverrideRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemOverrideRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemOverrideRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemOverrideRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemOverrideRequestDataAttributes + */ + public static CreateSceneItemOverrideRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemOverrideRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneItemOverrideRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataRelationships.java index 6347613..9d63495 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemOverrideRequestDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneItemRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemOverrideRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemOverrideRequestDataRelationships { public static final String SERIALIZED_NAME_SCENE_ITEM = "sceneItem"; @SerializedName(SERIALIZED_NAME_SCENE_ITEM) + @javax.annotation.Nonnull private SceneItemRelationship sceneItem; - public CreateSceneItemOverrideRequestDataRelationships() { + public CreateSceneItemOverrideRequestDataRelationships() { } - public CreateSceneItemOverrideRequestDataRelationships sceneItem(SceneItemRelationship sceneItem) { - + public CreateSceneItemOverrideRequestDataRelationships sceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; return this; } - /** + /** * Get sceneItem * @return sceneItem - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemRelationship getSceneItem() { return sceneItem; } - - public void setSceneItem(SceneItemRelationship sceneItem) { + public void setSceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sceneItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sceneItem"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemOverrideRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemOverrideRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemOverrideRequestDataRelationships is not found in the empty JSON string", CreateSceneItemOverrideRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemOverrideRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemOverrideRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneItemOverrideRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `sceneItem` + SceneItemRelationship.validateJsonElement(jsonObj.get("sceneItem")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemOverrideRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemOverrideRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemOverrideRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemOverrideRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemOverrideRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemOverrideRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemOverrideRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemOverrideRequestDataRelationships + */ + public static CreateSceneItemOverrideRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemOverrideRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateSceneItemOverrideRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequest.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequest.java index 51e1dfc..e803034 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneItemRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneItemRequestData data; - public CreateSceneItemRequest() { + public CreateSceneItemRequest() { } - public CreateSceneItemRequest data(CreateSceneItemRequestData data) { - + public CreateSceneItemRequest data(@javax.annotation.Nonnull CreateSceneItemRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemRequestData getData() { return data; } - - public void setData(CreateSceneItemRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneItemRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemRequest is not found in the empty JSON string", CreateSceneItemRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneItemRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneItemRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemRequest + */ + public static CreateSceneItemRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemRequest.class); + } + + /** + * Convert an instance of CreateSceneItemRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequestData.java index b4c75ab..6235e1b 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneItemRequestDataAttributes; import com.vertexvis.model.CreateSceneItemRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneItemRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneItemRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateSceneItemRequestDataRelationships relationships; - public CreateSceneItemRequestData() { + public CreateSceneItemRequestData() { } - public CreateSceneItemRequestData type(String type) { - + public CreateSceneItemRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneItemRequestData attributes(CreateSceneItemRequestDataAttributes attributes) { - + public CreateSceneItemRequestData attributes(@javax.annotation.Nonnull CreateSceneItemRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneItemRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneItemRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateSceneItemRequestData relationships(CreateSceneItemRequestDataRelationships relationships) { - + public CreateSceneItemRequestData relationships(@javax.annotation.Nonnull CreateSceneItemRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneItemRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateSceneItemRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateSceneItemRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemRequestData is not found in the empty JSON string", CreateSceneItemRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneItemRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneItemRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateSceneItemRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemRequestData + */ + public static CreateSceneItemRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemRequestData.class); + } + + /** + * Convert an instance of CreateSceneItemRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java index 313b13a..044dee3 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java @@ -14,339 +14,333 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; import com.vertexvis.model.ColorMaterial; import com.vertexvis.model.Matrix4; import com.vertexvis.model.PartRevisionSuppliedId; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemRequestDataAttributes { public static final String SERIALIZED_NAME_MATERIAL_OVERRIDE = "materialOverride"; @SerializedName(SERIALIZED_NAME_MATERIAL_OVERRIDE) + @javax.annotation.Nullable private ColorMaterial materialOverride; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nullable private Integer ordinal; public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable private String parent; public static final String SERIALIZED_NAME_PART_INSTANCE_SUPPLIED_IDS_AS_SUPPLIED_IDS = "partInstanceSuppliedIdsAsSuppliedIds"; @SerializedName(SERIALIZED_NAME_PART_INSTANCE_SUPPLIED_IDS_AS_SUPPLIED_IDS) + @javax.annotation.Nullable private Boolean partInstanceSuppliedIdsAsSuppliedIds; public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private PartRevisionSuppliedId source; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); - public CreateSceneItemRequestDataAttributes() { + public static final String SERIALIZED_NAME_EXPERIMENTAL_SOURCE_METADATA_KEYS = "experimentalSourceMetadataKeys"; + @SerializedName(SERIALIZED_NAME_EXPERIMENTAL_SOURCE_METADATA_KEYS) + @javax.annotation.Nullable + private List experimentalSourceMetadataKeys = new ArrayList<>(); + + public CreateSceneItemRequestDataAttributes() { } - public CreateSceneItemRequestDataAttributes materialOverride(ColorMaterial materialOverride) { - + public CreateSceneItemRequestDataAttributes materialOverride(@javax.annotation.Nullable ColorMaterial materialOverride) { this.materialOverride = materialOverride; return this; } - /** + /** * Get materialOverride * @return materialOverride - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterial getMaterialOverride() { return materialOverride; } - - public void setMaterialOverride(ColorMaterial materialOverride) { + public void setMaterialOverride(@javax.annotation.Nullable ColorMaterial materialOverride) { this.materialOverride = materialOverride; } - public CreateSceneItemRequestDataAttributes name(String name) { - + public CreateSceneItemRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public CreateSceneItemRequestDataAttributes ordinal(Integer ordinal) { - + public CreateSceneItemRequestDataAttributes ordinal(@javax.annotation.Nullable Integer ordinal) { this.ordinal = ordinal; return this; } - /** + /** * A 0-based index used for defining a consistent ordering amongst sibling scene items. * @return ordinal - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A 0-based index used for defining a consistent ordering amongst sibling scene items.") - public Integer getOrdinal() { return ordinal; } - - public void setOrdinal(Integer ordinal) { + public void setOrdinal(@javax.annotation.Nullable Integer ordinal) { this.ordinal = ordinal; } - public CreateSceneItemRequestDataAttributes parent(String parent) { - + public CreateSceneItemRequestDataAttributes parent(@javax.annotation.Nullable String parent) { this.parent = parent; return this; } - /** + /** * Optional ability to specify a parent scene item by scene item supplied ID. For example, an existing ID from a PLM system. This approach is an alternative to providing a specific scene item ID with the relationship parent property. * @return parent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "Optional ability to specify a parent scene item by scene item supplied ID. For example, an existing ID from a PLM system. This approach is an alternative to providing a specific scene item ID with the relationship parent property. ") - public String getParent() { return parent; } - - public void setParent(String parent) { + public void setParent(@javax.annotation.Nullable String parent) { this.parent = parent; } - public CreateSceneItemRequestDataAttributes partInstanceSuppliedIdsAsSuppliedIds(Boolean partInstanceSuppliedIdsAsSuppliedIds) { - + public CreateSceneItemRequestDataAttributes partInstanceSuppliedIdsAsSuppliedIds(@javax.annotation.Nullable Boolean partInstanceSuppliedIdsAsSuppliedIds) { this.partInstanceSuppliedIdsAsSuppliedIds = partInstanceSuppliedIdsAsSuppliedIds; return this; } - /** + /** * Whether or not to use part instance supplied IDs as scene item supplied IDs. * @return partInstanceSuppliedIdsAsSuppliedIds - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "false", value = "Whether or not to use part instance supplied IDs as scene item supplied IDs.") - public Boolean getPartInstanceSuppliedIdsAsSuppliedIds() { return partInstanceSuppliedIdsAsSuppliedIds; } - - public void setPartInstanceSuppliedIdsAsSuppliedIds(Boolean partInstanceSuppliedIdsAsSuppliedIds) { + public void setPartInstanceSuppliedIdsAsSuppliedIds(@javax.annotation.Nullable Boolean partInstanceSuppliedIdsAsSuppliedIds) { this.partInstanceSuppliedIdsAsSuppliedIds = partInstanceSuppliedIdsAsSuppliedIds; } - public CreateSceneItemRequestDataAttributes source(PartRevisionSuppliedId source) { - + public CreateSceneItemRequestDataAttributes source(@javax.annotation.Nullable PartRevisionSuppliedId source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRevisionSuppliedId getSource() { return source; } - - public void setSource(PartRevisionSuppliedId source) { + public void setSource(@javax.annotation.Nullable PartRevisionSuppliedId source) { this.source = source; } - public CreateSceneItemRequestDataAttributes suppliedId(String suppliedId) { - + public CreateSceneItemRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public CreateSceneItemRequestDataAttributes transform(Matrix4 transform) { - + public CreateSceneItemRequestDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } - public CreateSceneItemRequestDataAttributes visible(Boolean visible) { - + public CreateSceneItemRequestDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Item visibility. * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Item visibility.") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public CreateSceneItemRequestDataAttributes phantom(Boolean phantom) { - + public CreateSceneItemRequestDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Phantom state of the item. * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Phantom state of the item.") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public CreateSceneItemRequestDataAttributes endItem(Boolean endItem) { - + public CreateSceneItemRequestDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Whether this item is an end item. * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this item is an end item.") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } - public CreateSceneItemRequestDataAttributes metadata(Map metadata) { - + public CreateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public CreateSceneItemRequestDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public CreateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -354,23 +348,48 @@ public CreateSceneItemRequestDataAttributes putMetadataItem(String key, AnyOfMet return this; } - /** + /** * Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. ") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } + public CreateSceneItemRequestDataAttributes experimentalSourceMetadataKeys(@javax.annotation.Nullable List experimentalSourceMetadataKeys) { + this.experimentalSourceMetadataKeys = experimentalSourceMetadataKeys; + return this; + } + + public CreateSceneItemRequestDataAttributes addExperimentalSourceMetadataKeysItem(String experimentalSourceMetadataKeysItem) { + if (this.experimentalSourceMetadataKeys == null) { + this.experimentalSourceMetadataKeys = new ArrayList<>(); + } + this.experimentalSourceMetadataKeys.add(experimentalSourceMetadataKeysItem); + return this; + } + + /** + * Specifies which metadata keys should be copied from the source item. Sending null will default to all keys. Sending an empty string will copy none of the sources' metadata. Sending an array of [\"KEY1\", \"KEY2] will include KEY1 and KEY2 from the source in the scene item creation. This is marked experimental since future releases are expected to prevent copying metadata entirely. + * @return experimentalSourceMetadataKeys + */ + @javax.annotation.Nullable + public List getExperimentalSourceMetadataKeys() { + return experimentalSourceMetadataKeys; + } + + public void setExperimentalSourceMetadataKeys(@javax.annotation.Nullable List experimentalSourceMetadataKeys) { + this.experimentalSourceMetadataKeys = experimentalSourceMetadataKeys; + } + + + @Override public boolean equals(Object o) { if (this == o) { @@ -391,12 +410,13 @@ public boolean equals(Object o) { Objects.equals(this.visible, createSceneItemRequestDataAttributes.visible) && Objects.equals(this.phantom, createSceneItemRequestDataAttributes.phantom) && Objects.equals(this.endItem, createSceneItemRequestDataAttributes.endItem) && - Objects.equals(this.metadata, createSceneItemRequestDataAttributes.metadata); + Objects.equals(this.metadata, createSceneItemRequestDataAttributes.metadata) && + Objects.equals(this.experimentalSourceMetadataKeys, createSceneItemRequestDataAttributes.experimentalSourceMetadataKeys); } @Override public int hashCode() { - return Objects.hash(materialOverride, name, ordinal, parent, partInstanceSuppliedIdsAsSuppliedIds, source, suppliedId, transform, visible, phantom, endItem, metadata); + return Objects.hash(materialOverride, name, ordinal, parent, partInstanceSuppliedIdsAsSuppliedIds, source, suppliedId, transform, visible, phantom, endItem, metadata, experimentalSourceMetadataKeys); } @Override @@ -415,6 +435,7 @@ public String toString() { sb.append(" phantom: ").append(toIndentedString(phantom)).append("\n"); sb.append(" endItem: ").append(toIndentedString(endItem)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" experimentalSourceMetadataKeys: ").append(toIndentedString(experimentalSourceMetadataKeys)).append("\n"); sb.append("}"); return sb.toString(); } @@ -430,5 +451,126 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("materialOverride"); + openapiFields.add("name"); + openapiFields.add("ordinal"); + openapiFields.add("parent"); + openapiFields.add("partInstanceSuppliedIdsAsSuppliedIds"); + openapiFields.add("source"); + openapiFields.add("suppliedId"); + openapiFields.add("transform"); + openapiFields.add("visible"); + openapiFields.add("phantom"); + openapiFields.add("endItem"); + openapiFields.add("metadata"); + openapiFields.add("experimentalSourceMetadataKeys"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemRequestDataAttributes is not found in the empty JSON string", CreateSceneItemRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `materialOverride` + if (jsonObj.get("materialOverride") != null && !jsonObj.get("materialOverride").isJsonNull()) { + ColorMaterial.validateJsonElement(jsonObj.get("materialOverride")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) && !jsonObj.get("parent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parent").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + PartRevisionSuppliedId.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("experimentalSourceMetadataKeys") != null && !jsonObj.get("experimentalSourceMetadataKeys").isJsonNull() && !jsonObj.get("experimentalSourceMetadataKeys").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `experimentalSourceMetadataKeys` to be an array in the JSON string but got `%s`", jsonObj.get("experimentalSourceMetadataKeys").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemRequestDataAttributes + */ + public static CreateSceneItemRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneItemRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationships.java index ee03421..8937345 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationships.java @@ -14,107 +14,120 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneItemRequestDataRelationshipsSource; import com.vertexvis.model.SceneItemRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneItemRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneItemRequestDataRelationships { public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable private SceneItemRelationship parent; public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) - private AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source; + @javax.annotation.Nullable + private CreateSceneItemRequestDataRelationshipsSource source; public static final String SERIALIZED_NAME_REFERENCE_TREE = "referenceTree"; @SerializedName(SERIALIZED_NAME_REFERENCE_TREE) + @javax.annotation.Nullable private SceneItemRelationship referenceTree; - public CreateSceneItemRequestDataRelationships() { + public CreateSceneItemRequestDataRelationships() { } - public CreateSceneItemRequestDataRelationships parent(SceneItemRelationship parent) { - + public CreateSceneItemRequestDataRelationships parent(@javax.annotation.Nullable SceneItemRelationship parent) { this.parent = parent; return this; } - /** + /** * Get parent * @return parent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public SceneItemRelationship getParent() { return parent; } - - public void setParent(SceneItemRelationship parent) { + public void setParent(@javax.annotation.Nullable SceneItemRelationship parent) { this.parent = parent; } - public CreateSceneItemRequestDataRelationships source(AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source) { - + public CreateSceneItemRequestDataRelationships source(@javax.annotation.Nullable CreateSceneItemRequestDataRelationshipsSource source) { this.source = source; return this; } - /** - * Relationship to a `geometry-set`, `part-revision`, `part-rendition`, or `scene`. + /** + * Get source * @return source - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Relationship to a `geometry-set`, `part-revision`, `part-rendition`, or `scene`.") - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship getSource() { + public CreateSceneItemRequestDataRelationshipsSource getSource() { return source; } - - public void setSource(AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source) { + public void setSource(@javax.annotation.Nullable CreateSceneItemRequestDataRelationshipsSource source) { this.source = source; } - public CreateSceneItemRequestDataRelationships referenceTree(SceneItemRelationship referenceTree) { - + public CreateSceneItemRequestDataRelationships referenceTree(@javax.annotation.Nullable SceneItemRelationship referenceTree) { this.referenceTree = referenceTree; return this; } - /** + /** * Get referenceTree * @return referenceTree - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public SceneItemRelationship getReferenceTree() { return referenceTree; } - - public void setReferenceTree(SceneItemRelationship referenceTree) { + public void setReferenceTree(@javax.annotation.Nullable SceneItemRelationship referenceTree) { this.referenceTree = referenceTree; } + @Override public boolean equals(Object o) { if (this == o) { @@ -129,22 +142,11 @@ public boolean equals(Object o) { Objects.equals(this.referenceTree, createSceneItemRequestDataRelationships.referenceTree); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(parent, source, referenceTree); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -167,5 +169,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("parent"); + openapiFields.add("source"); + openapiFields.add("referenceTree"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneItemRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneItemRequestDataRelationships is not found in the empty JSON string", CreateSceneItemRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneItemRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneItemRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `parent` + if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { + SceneItemRelationship.validateJsonElement(jsonObj.get("parent")); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + CreateSceneItemRequestDataRelationshipsSource.validateJsonElement(jsonObj.get("source")); + } + // validate the optional field `referenceTree` + if (jsonObj.get("referenceTree") != null && !jsonObj.get("referenceTree").isJsonNull()) { + SceneItemRelationship.validateJsonElement(jsonObj.get("referenceTree")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneItemRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneItemRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneItemRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemRequestDataRelationships + */ + public static CreateSceneItemRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateSceneItemRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationshipsSource.java new file mode 100644 index 0000000..3261418 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataRelationshipsSource.java @@ -0,0 +1,360 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.GeometrySetRelationship; +import com.vertexvis.model.PartRenditionRelationship; +import com.vertexvis.model.PartRenditionRelationshipData; +import com.vertexvis.model.PartRevisionRelationship; +import com.vertexvis.model.SceneRelationship; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneItemRequestDataRelationshipsSource extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateSceneItemRequestDataRelationshipsSource.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneItemRequestDataRelationshipsSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneItemRequestDataRelationshipsSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterGeometrySetRelationship = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetRelationship.class)); + final TypeAdapter adapterPartRevisionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionRelationship.class)); + final TypeAdapter adapterSceneRelationship = gson.getDelegateAdapter(this, TypeToken.get(SceneRelationship.class)); + final TypeAdapter adapterPartRenditionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneItemRequestDataRelationshipsSource value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `GeometrySetRelationship` + if (value.getActualInstance() instanceof GeometrySetRelationship) { + JsonElement element = adapterGeometrySetRelationship.toJsonTree((GeometrySetRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionRelationship` + if (value.getActualInstance() instanceof PartRevisionRelationship) { + JsonElement element = adapterPartRevisionRelationship.toJsonTree((PartRevisionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneRelationship` + if (value.getActualInstance() instanceof SceneRelationship) { + JsonElement element = adapterSceneRelationship.toJsonTree((SceneRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRenditionRelationship` + if (value.getActualInstance() instanceof PartRenditionRelationship) { + JsonElement element = adapterPartRenditionRelationship.toJsonTree((PartRenditionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship"); + } + + @Override + public CreateSceneItemRequestDataRelationshipsSource read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GeometrySetRelationship + try { + // validate the JSON object to see if any exception is thrown + GeometrySetRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterGeometrySetRelationship; + CreateSceneItemRequestDataRelationshipsSource ret = new CreateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'GeometrySetRelationship'", e); + } + // deserialize PartRevisionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRevisionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionRelationship; + CreateSceneItemRequestDataRelationshipsSource ret = new CreateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionRelationship'", e); + } + // deserialize SceneRelationship + try { + // validate the JSON object to see if any exception is thrown + SceneRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterSceneRelationship; + CreateSceneItemRequestDataRelationshipsSource ret = new CreateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneRelationship'", e); + } + // deserialize PartRenditionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRenditionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRenditionRelationship; + CreateSceneItemRequestDataRelationshipsSource ret = new CreateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRenditionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRenditionRelationship'", e); + } + + throw new IOException(String.format("Failed deserialization for CreateSceneItemRequestDataRelationshipsSource: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public CreateSceneItemRequestDataRelationshipsSource() { + super("anyOf", Boolean.FALSE); + } + + public CreateSceneItemRequestDataRelationshipsSource(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeometrySetRelationship", GeometrySetRelationship.class); + schemas.put("PartRevisionRelationship", PartRevisionRelationship.class); + schemas.put("SceneRelationship", SceneRelationship.class); + schemas.put("PartRenditionRelationship", PartRenditionRelationship.class); + } + + @Override + public Map> getSchemas() { + return CreateSceneItemRequestDataRelationshipsSource.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GeometrySetRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRenditionRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship + * + * @return The actual instance (GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeometrySetRelationship`. If the actual instance is not `GeometrySetRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GeometrySetRelationship` + * @throws ClassCastException if the instance is not `GeometrySetRelationship` + */ + public GeometrySetRelationship getGeometrySetRelationship() throws ClassCastException { + return (GeometrySetRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionRelationship`. If the actual instance is not `PartRevisionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionRelationship` + * @throws ClassCastException if the instance is not `PartRevisionRelationship` + */ + public PartRevisionRelationship getPartRevisionRelationship() throws ClassCastException { + return (PartRevisionRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneRelationship`. If the actual instance is not `SceneRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneRelationship` + * @throws ClassCastException if the instance is not `SceneRelationship` + */ + public SceneRelationship getSceneRelationship() throws ClassCastException { + return (SceneRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRenditionRelationship`. If the actual instance is not `PartRenditionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRenditionRelationship` + * @throws ClassCastException if the instance is not `PartRenditionRelationship` + */ + public PartRenditionRelationship getPartRenditionRelationship() throws ClassCastException { + return (PartRenditionRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneItemRequestDataRelationshipsSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GeometrySetRelationship + try { + GeometrySetRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionRelationship + try { + PartRevisionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneRelationship + try { + SceneRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRenditionRelationship + try { + PartRenditionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRenditionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for CreateSceneItemRequestDataRelationshipsSource with anyOf schemas: GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of CreateSceneItemRequestDataRelationshipsSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneItemRequestDataRelationshipsSource + * @throws IOException if the JSON string is invalid with respect to CreateSceneItemRequestDataRelationshipsSource + */ + public static CreateSceneItemRequestDataRelationshipsSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneItemRequestDataRelationshipsSource.class); + } + + /** + * Convert an instance of CreateSceneItemRequestDataRelationshipsSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneRequest.java b/src/main/java/com/vertexvis/model/CreateSceneRequest.java index ec582c3..d19fe0f 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneRequestData data; - public CreateSceneRequest() { + public CreateSceneRequest() { } - public CreateSceneRequest data(CreateSceneRequestData data) { - + public CreateSceneRequest data(@javax.annotation.Nonnull CreateSceneRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneRequestData getData() { return data; } - - public void setData(CreateSceneRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneRequest is not found in the empty JSON string", CreateSceneRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneRequest + */ + public static CreateSceneRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneRequest.class); + } + + /** + * Convert an instance of CreateSceneRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneRequestData.java index 0b1757c..0ba9822 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneRequestDataAttributes; import com.vertexvis.model.CreateSceneRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private CreateSceneRequestDataRelationships relationships; - public CreateSceneRequestData() { + public CreateSceneRequestData() { } - public CreateSceneRequestData type(String type) { - + public CreateSceneRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneRequestData attributes(CreateSceneRequestDataAttributes attributes) { - + public CreateSceneRequestData attributes(@javax.annotation.Nonnull CreateSceneRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateSceneRequestData relationships(CreateSceneRequestDataRelationships relationships) { - + public CreateSceneRequestData relationships(@javax.annotation.Nullable CreateSceneRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CreateSceneRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateSceneRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable CreateSceneRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneRequestData is not found in the empty JSON string", CreateSceneRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateSceneRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneRequestData + */ + public static CreateSceneRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneRequestData.class); + } + + /** + * Convert an instance of CreateSceneRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneRequestDataAttributes.java index 66f56b4..00ecac0 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneRequestDataAttributes.java @@ -14,172 +14,175 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera; import com.vertexvis.model.Orientation; -import com.vertexvis.model.OrthographicCamera; -import com.vertexvis.model.PerspectiveCamera; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneRequestDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private OneOfPerspectiveCameraOrthographicCamera camera; + @javax.annotation.Nullable + private CreateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TREE_ENABLED = "treeEnabled"; @SerializedName(SERIALIZED_NAME_TREE_ENABLED) + @javax.annotation.Nullable private Boolean treeEnabled; public static final String SERIALIZED_NAME_WORLD_ORIENTATION = "worldOrientation"; @SerializedName(SERIALIZED_NAME_WORLD_ORIENTATION) + @javax.annotation.Nullable private Orientation worldOrientation; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); - public CreateSceneRequestDataAttributes() { + public CreateSceneRequestDataAttributes() { } - public CreateSceneRequestDataAttributes camera(OneOfPerspectiveCameraOrthographicCamera camera) { - + public CreateSceneRequestDataAttributes camera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public OneOfPerspectiveCameraOrthographicCamera getCamera() { + public CreateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(OneOfPerspectiveCameraOrthographicCamera camera) { + public void setCamera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public CreateSceneRequestDataAttributes suppliedId(String suppliedId) { - + public CreateSceneRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public CreateSceneRequestDataAttributes name(String name) { - + public CreateSceneRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public CreateSceneRequestDataAttributes treeEnabled(Boolean treeEnabled) { - + public CreateSceneRequestDataAttributes treeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; return this; } - /** + /** * Get treeEnabled * @return treeEnabled - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "false", value = "") - public Boolean getTreeEnabled() { return treeEnabled; } - - public void setTreeEnabled(Boolean treeEnabled) { + public void setTreeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; } - public CreateSceneRequestDataAttributes worldOrientation(Orientation worldOrientation) { - + public CreateSceneRequestDataAttributes worldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; return this; } - /** + /** * Get worldOrientation * @return worldOrientation - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Orientation getWorldOrientation() { return worldOrientation; } - - public void setWorldOrientation(Orientation worldOrientation) { + public void setWorldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; } - public CreateSceneRequestDataAttributes metadata(Map metadata) { - + public CreateSceneRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } @@ -192,23 +195,21 @@ public CreateSceneRequestDataAttributes putMetadataItem(String key, String metad return this; } - /** - * User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. + /** + * User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. A null value will delete the entry in the map, all other key/value pairs provided here will be inserted or updated into the existing scene metadata. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. ") - public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } + @Override public boolean equals(Object o) { if (this == o) { @@ -226,22 +227,11 @@ public boolean equals(Object o) { Objects.equals(this.metadata, createSceneRequestDataAttributes.metadata); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(camera, suppliedId, name, treeEnabled, worldOrientation, metadata); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -267,5 +257,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("suppliedId"); + openapiFields.add("name"); + openapiFields.add("treeEnabled"); + openapiFields.add("worldOrientation"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneRequestDataAttributes is not found in the empty JSON string", CreateSceneRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + CreateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `worldOrientation` + if (jsonObj.get("worldOrientation") != null && !jsonObj.get("worldOrientation").isJsonNull()) { + Orientation.validateJsonElement(jsonObj.get("worldOrientation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneRequestDataAttributes + */ + public static CreateSceneRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateSceneRequestDataRelationships.java index 91dc0e8..29cea37 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateSceneRequestDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull private SceneRelationship source; - public CreateSceneRequestDataRelationships() { + public CreateSceneRequestDataRelationships() { } - public CreateSceneRequestDataRelationships source(SceneRelationship source) { - + public CreateSceneRequestDataRelationships source(@javax.annotation.Nonnull SceneRelationship source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneRelationship getSource() { return source; } - - public void setSource(SceneRelationship source) { + public void setSource(@javax.annotation.Nonnull SceneRelationship source) { this.source = source; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneRequestDataRelationships is not found in the empty JSON string", CreateSceneRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `source` + SceneRelationship.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateSceneRequestDataRelationships + */ + public static CreateSceneRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateSceneRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneSyncRequest.java b/src/main/java/com/vertexvis/model/CreateSceneSyncRequest.java index 6513f1d..c7812d1 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneSyncRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneSyncRequest.java @@ -14,61 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.OneOfUpdateItemToDefaultRenditionOperation; -import com.vertexvis.model.UpdateItemToDefaultRenditionOperation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.CreateSceneSyncRequestOperation; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * An operation to perform on a Scene. */ -@ApiModel(description = "An operation to perform on a Scene.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneSyncRequest { - public static final String SERIALIZED_NAME_OPERATIONS = "operations"; - @SerializedName(SERIALIZED_NAME_OPERATIONS) - private List operations = new ArrayList<>(); - - public CreateSceneSyncRequest() { - } + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + @javax.annotation.Nonnull + private CreateSceneSyncRequestOperation operation; - public CreateSceneSyncRequest operations(List operations) { - - this.operations = operations; - return this; + public CreateSceneSyncRequest() { } - public CreateSceneSyncRequest addOperationsItem(OneOfUpdateItemToDefaultRenditionOperation operationsItem) { - this.operations.add(operationsItem); + public CreateSceneSyncRequest operation(@javax.annotation.Nonnull CreateSceneSyncRequestOperation operation) { + this.operation = operation; return this; } - /** - * List of operations to perform on `scene-items` in the scene. - * @return operations - **/ + /** + * Get operation + * @return operation + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "List of operations to perform on `scene-items` in the scene.") - - public List getOperations() { - return operations; + public CreateSceneSyncRequestOperation getOperation() { + return operation; } - - public void setOperations(List operations) { - this.operations = operations; + public void setOperation(@javax.annotation.Nonnull CreateSceneSyncRequestOperation operation) { + this.operation = operation; } + @Override public boolean equals(Object o) { if (this == o) { @@ -78,19 +88,19 @@ public boolean equals(Object o) { return false; } CreateSceneSyncRequest createSceneSyncRequest = (CreateSceneSyncRequest) o; - return Objects.equals(this.operations, createSceneSyncRequest.operations); + return Objects.equals(this.operation, createSceneSyncRequest.operation); } @Override public int hashCode() { - return Objects.hash(operations); + return Objects.hash(operation); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateSceneSyncRequest {\n"); - sb.append(" operations: ").append(toIndentedString(operations)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); sb.append("}"); return sb.toString(); } @@ -106,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("operation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("operation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneSyncRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneSyncRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneSyncRequest is not found in the empty JSON string", CreateSceneSyncRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneSyncRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneSyncRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneSyncRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `operation` + CreateSceneSyncRequestOperation.validateJsonElement(jsonObj.get("operation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneSyncRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneSyncRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneSyncRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneSyncRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneSyncRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneSyncRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneSyncRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneSyncRequest + */ + public static CreateSceneSyncRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneSyncRequest.class); + } + + /** + * Convert an instance of CreateSceneSyncRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneSyncRequestOperation.java b/src/main/java/com/vertexvis/model/CreateSceneSyncRequestOperation.java new file mode 100644 index 0000000..e1fc602 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneSyncRequestOperation.java @@ -0,0 +1,231 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpdateItemToDefaultRenditionOperation; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneSyncRequestOperation extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateSceneSyncRequestOperation.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneSyncRequestOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneSyncRequestOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUpdateItemToDefaultRenditionOperation = gson.getDelegateAdapter(this, TypeToken.get(UpdateItemToDefaultRenditionOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneSyncRequestOperation value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UpdateItemToDefaultRenditionOperation` + if (value.getActualInstance() instanceof UpdateItemToDefaultRenditionOperation) { + JsonElement element = adapterUpdateItemToDefaultRenditionOperation.toJsonTree((UpdateItemToDefaultRenditionOperation)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: UpdateItemToDefaultRenditionOperation"); + } + + @Override + public CreateSceneSyncRequestOperation read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UpdateItemToDefaultRenditionOperation + try { + // validate the JSON object to see if any exception is thrown + UpdateItemToDefaultRenditionOperation.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateItemToDefaultRenditionOperation; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateItemToDefaultRenditionOperation'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateItemToDefaultRenditionOperation failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateItemToDefaultRenditionOperation'", e); + } + + if (match == 1) { + CreateSceneSyncRequestOperation ret = new CreateSceneSyncRequestOperation(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateSceneSyncRequestOperation: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateSceneSyncRequestOperation() { + super("oneOf", Boolean.FALSE); + } + + public CreateSceneSyncRequestOperation(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UpdateItemToDefaultRenditionOperation", UpdateItemToDefaultRenditionOperation.class); + } + + @Override + public Map> getSchemas() { + return CreateSceneSyncRequestOperation.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * UpdateItemToDefaultRenditionOperation + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UpdateItemToDefaultRenditionOperation) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UpdateItemToDefaultRenditionOperation"); + } + + /** + * Get the actual instance, which can be the following: + * UpdateItemToDefaultRenditionOperation + * + * @return The actual instance (UpdateItemToDefaultRenditionOperation) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateItemToDefaultRenditionOperation`. If the actual instance is not `UpdateItemToDefaultRenditionOperation`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateItemToDefaultRenditionOperation` + * @throws ClassCastException if the instance is not `UpdateItemToDefaultRenditionOperation` + */ + public UpdateItemToDefaultRenditionOperation getUpdateItemToDefaultRenditionOperation() throws ClassCastException { + return (UpdateItemToDefaultRenditionOperation)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneSyncRequestOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UpdateItemToDefaultRenditionOperation + try { + UpdateItemToDefaultRenditionOperation.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateItemToDefaultRenditionOperation failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateSceneSyncRequestOperation with oneOf schemas: UpdateItemToDefaultRenditionOperation. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateSceneSyncRequestOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneSyncRequestOperation + * @throws IOException if the JSON string is invalid with respect to CreateSceneSyncRequestOperation + */ + public static CreateSceneSyncRequestOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneSyncRequestOperation.class); + } + + /** + * Convert an instance of CreateSceneSyncRequestOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewRequest.java b/src/main/java/com/vertexvis/model/CreateSceneViewRequest.java index 10391b2..b7194f1 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneViewRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneViewRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneViewRequestData data; - public CreateSceneViewRequest() { + public CreateSceneViewRequest() { } - public CreateSceneViewRequest data(CreateSceneViewRequestData data) { - + public CreateSceneViewRequest data(@javax.annotation.Nonnull CreateSceneViewRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewRequestData getData() { return data; } - - public void setData(CreateSceneViewRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneViewRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewRequest is not found in the empty JSON string", CreateSceneViewRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneViewRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneViewRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewRequest + */ + public static CreateSceneViewRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewRequest.class); + } + + /** + * Convert an instance of CreateSceneViewRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneViewRequestData.java index a3b2e18..b13183d 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneViewRequestDataAttributes; import com.vertexvis.model.CreateSceneViewRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneViewRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneViewRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private CreateSceneViewRequestDataRelationships relationships; - public CreateSceneViewRequestData() { + public CreateSceneViewRequestData() { } - public CreateSceneViewRequestData type(String type) { - + public CreateSceneViewRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneViewRequestData attributes(CreateSceneViewRequestDataAttributes attributes) { - + public CreateSceneViewRequestData attributes(@javax.annotation.Nonnull CreateSceneViewRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneViewRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneViewRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateSceneViewRequestData relationships(CreateSceneViewRequestDataRelationships relationships) { - + public CreateSceneViewRequestData relationships(@javax.annotation.Nullable CreateSceneViewRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CreateSceneViewRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateSceneViewRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable CreateSceneViewRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewRequestData is not found in the empty JSON string", CreateSceneViewRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneViewRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneViewRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateSceneViewRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewRequestData + */ + public static CreateSceneViewRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewRequestData.class); + } + + /** + * Convert an instance of CreateSceneViewRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributes.java index 59c4530..e21e11c 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributes.java @@ -14,109 +14,121 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera; import com.vertexvis.model.CrossSectioning; -import com.vertexvis.model.OrthographicCamera; -import com.vertexvis.model.PerspectiveCamera; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import org.openapitools.jackson.nullable.JsonNullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneViewRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewRequestDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private OneOfPerspectiveCameraOrthographicCamera camera; + @javax.annotation.Nullable + private CreateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_CROSS_SECTIONING = "crossSectioning"; @SerializedName(SERIALIZED_NAME_CROSS_SECTIONING) + @javax.annotation.Nullable private CrossSectioning crossSectioning; public static final String SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS = "excludePrunedItems"; @SerializedName(SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS) + @javax.annotation.Nullable private Boolean excludePrunedItems; - public CreateSceneViewRequestDataAttributes() { + public CreateSceneViewRequestDataAttributes() { } - public CreateSceneViewRequestDataAttributes camera(OneOfPerspectiveCameraOrthographicCamera camera) { - + public CreateSceneViewRequestDataAttributes camera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public OneOfPerspectiveCameraOrthographicCamera getCamera() { + public CreateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(OneOfPerspectiveCameraOrthographicCamera camera) { + public void setCamera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public CreateSceneViewRequestDataAttributes crossSectioning(CrossSectioning crossSectioning) { - + public CreateSceneViewRequestDataAttributes crossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; return this; } - /** + /** * Get crossSectioning * @return crossSectioning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CrossSectioning getCrossSectioning() { return crossSectioning; } - - public void setCrossSectioning(CrossSectioning crossSectioning) { + public void setCrossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; } - public CreateSceneViewRequestDataAttributes excludePrunedItems(Boolean excludePrunedItems) { - + public CreateSceneViewRequestDataAttributes excludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; return this; } - /** + /** * Whether to exclude non-visible items in the view * @return excludePrunedItems - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Whether to exclude non-visible items in the view") - public Boolean getExcludePrunedItems() { return excludePrunedItems; } - - public void setExcludePrunedItems(Boolean excludePrunedItems) { + public void setExcludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; } + @Override public boolean equals(Object o) { if (this == o) { @@ -169,5 +181,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("crossSectioning"); + openapiFields.add("excludePrunedItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewRequestDataAttributes is not found in the empty JSON string", CreateSceneViewRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + CreateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + // validate the optional field `crossSectioning` + if (jsonObj.get("crossSectioning") != null && !jsonObj.get("crossSectioning").isJsonNull()) { + CrossSectioning.validateJsonElement(jsonObj.get("crossSectioning")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewRequestDataAttributes + */ + public static CreateSceneViewRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneViewRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributesCamera.java b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributesCamera.java new file mode 100644 index 0000000..6968489 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataAttributesCamera.java @@ -0,0 +1,277 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.OrthographicCamera; +import com.vertexvis.model.PerspectiveCamera; +import com.vertexvis.model.Vector3; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneViewRequestDataAttributesCamera extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateSceneViewRequestDataAttributesCamera.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewRequestDataAttributesCamera.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewRequestDataAttributesCamera' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPerspectiveCamera = gson.getDelegateAdapter(this, TypeToken.get(PerspectiveCamera.class)); + final TypeAdapter adapterOrthographicCamera = gson.getDelegateAdapter(this, TypeToken.get(OrthographicCamera.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewRequestDataAttributesCamera value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PerspectiveCamera` + if (value.getActualInstance() instanceof PerspectiveCamera) { + JsonElement element = adapterPerspectiveCamera.toJsonTree((PerspectiveCamera)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `OrthographicCamera` + if (value.getActualInstance() instanceof OrthographicCamera) { + JsonElement element = adapterOrthographicCamera.toJsonTree((OrthographicCamera)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: OrthographicCamera, PerspectiveCamera"); + } + + @Override + public CreateSceneViewRequestDataAttributesCamera read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PerspectiveCamera + try { + // validate the JSON object to see if any exception is thrown + PerspectiveCamera.validateJsonElement(jsonElement); + actualAdapter = adapterPerspectiveCamera; + match++; + log.log(Level.FINER, "Input data matches schema 'PerspectiveCamera'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PerspectiveCamera failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PerspectiveCamera'", e); + } + // deserialize OrthographicCamera + try { + // validate the JSON object to see if any exception is thrown + OrthographicCamera.validateJsonElement(jsonElement); + actualAdapter = adapterOrthographicCamera; + match++; + log.log(Level.FINER, "Input data matches schema 'OrthographicCamera'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OrthographicCamera failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'OrthographicCamera'", e); + } + + if (match == 1) { + CreateSceneViewRequestDataAttributesCamera ret = new CreateSceneViewRequestDataAttributesCamera(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateSceneViewRequestDataAttributesCamera: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateSceneViewRequestDataAttributesCamera() { + super("oneOf", Boolean.FALSE); + } + + public CreateSceneViewRequestDataAttributesCamera(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PerspectiveCamera", PerspectiveCamera.class); + schemas.put("OrthographicCamera", OrthographicCamera.class); + } + + @Override + public Map> getSchemas() { + return CreateSceneViewRequestDataAttributesCamera.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * OrthographicCamera, PerspectiveCamera + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PerspectiveCamera) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof OrthographicCamera) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be OrthographicCamera, PerspectiveCamera"); + } + + /** + * Get the actual instance, which can be the following: + * OrthographicCamera, PerspectiveCamera + * + * @return The actual instance (OrthographicCamera, PerspectiveCamera) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PerspectiveCamera`. If the actual instance is not `PerspectiveCamera`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PerspectiveCamera` + * @throws ClassCastException if the instance is not `PerspectiveCamera` + */ + public PerspectiveCamera getPerspectiveCamera() throws ClassCastException { + return (PerspectiveCamera)super.getActualInstance(); + } + + /** + * Get the actual instance of `OrthographicCamera`. If the actual instance is not `OrthographicCamera`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OrthographicCamera` + * @throws ClassCastException if the instance is not `OrthographicCamera` + */ + public OrthographicCamera getOrthographicCamera() throws ClassCastException { + return (OrthographicCamera)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewRequestDataAttributesCamera + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PerspectiveCamera + try { + PerspectiveCamera.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PerspectiveCamera failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with OrthographicCamera + try { + OrthographicCamera.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for OrthographicCamera failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateSceneViewRequestDataAttributesCamera with oneOf schemas: OrthographicCamera, PerspectiveCamera. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateSceneViewRequestDataAttributesCamera given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewRequestDataAttributesCamera + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewRequestDataAttributesCamera + */ + public static CreateSceneViewRequestDataAttributesCamera fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewRequestDataAttributesCamera.class); + } + + /** + * Convert an instance of CreateSceneViewRequestDataAttributesCamera to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataRelationships.java index f8d642f..004fb58 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewRequestDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneViewStateRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneViewRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewRequestDataRelationships { public static final String SERIALIZED_NAME_SCENE_VIEW_STATE = "sceneViewState"; @SerializedName(SERIALIZED_NAME_SCENE_VIEW_STATE) + @javax.annotation.Nullable private SceneViewStateRelationship sceneViewState; - public CreateSceneViewRequestDataRelationships() { + public CreateSceneViewRequestDataRelationships() { } - public CreateSceneViewRequestDataRelationships sceneViewState(SceneViewStateRelationship sceneViewState) { - + public CreateSceneViewRequestDataRelationships sceneViewState(@javax.annotation.Nullable SceneViewStateRelationship sceneViewState) { this.sceneViewState = sceneViewState; return this; } - /** + /** * Get sceneViewState * @return sceneViewState - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public SceneViewStateRelationship getSceneViewState() { return sceneViewState; } - - public void setSceneViewState(SceneViewStateRelationship sceneViewState) { + public void setSceneViewState(@javax.annotation.Nullable SceneViewStateRelationship sceneViewState) { this.sceneViewState = sceneViewState; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,93 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sceneViewState"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewRequestDataRelationships is not found in the empty JSON string", CreateSceneViewRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `sceneViewState` + if (jsonObj.get("sceneViewState") != null && !jsonObj.get("sceneViewState").isJsonNull()) { + SceneViewStateRelationship.validateJsonElement(jsonObj.get("sceneViewState")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewRequestDataRelationships + */ + public static CreateSceneViewRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateSceneViewRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequest.java b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequest.java index 61ad470..5067ec0 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequest.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneViewStateRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneViewStateRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewStateRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateSceneViewStateRequestData data; - public CreateSceneViewStateRequest() { + public CreateSceneViewStateRequest() { } - public CreateSceneViewStateRequest data(CreateSceneViewStateRequestData data) { - + public CreateSceneViewStateRequest data(@javax.annotation.Nonnull CreateSceneViewStateRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewStateRequestData getData() { return data; } - - public void setData(CreateSceneViewStateRequestData data) { + public void setData(@javax.annotation.Nonnull CreateSceneViewStateRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewStateRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewStateRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewStateRequest is not found in the empty JSON string", CreateSceneViewStateRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewStateRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewStateRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneViewStateRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneViewStateRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewStateRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewStateRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewStateRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewStateRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewStateRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewStateRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewStateRequest + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewStateRequest + */ + public static CreateSceneViewStateRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewStateRequest.class); + } + + /** + * Convert an instance of CreateSceneViewStateRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestData.java b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestData.java index 9689fbe..0471cb6 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneViewStateRequestDataAttributes; import com.vertexvis.model.CreateSceneViewStateRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreateSceneViewStateRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewStateRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneViewStateRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateSceneViewStateRequestDataRelationships relationships; - public CreateSceneViewStateRequestData() { + public CreateSceneViewStateRequestData() { } - public CreateSceneViewStateRequestData type(String type) { - + public CreateSceneViewStateRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view-state", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateSceneViewStateRequestData attributes(CreateSceneViewStateRequestDataAttributes attributes) { - + public CreateSceneViewStateRequestData attributes(@javax.annotation.Nonnull CreateSceneViewStateRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewStateRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneViewStateRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneViewStateRequestDataAttributes attributes) { this.attributes = attributes; } - public CreateSceneViewStateRequestData relationships(CreateSceneViewStateRequestDataRelationships relationships) { - + public CreateSceneViewStateRequestData relationships(@javax.annotation.Nonnull CreateSceneViewStateRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewStateRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateSceneViewStateRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateSceneViewStateRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewStateRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewStateRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewStateRequestData is not found in the empty JSON string", CreateSceneViewStateRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewStateRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewStateRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneViewStateRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneViewStateRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateSceneViewStateRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewStateRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewStateRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewStateRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewStateRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewStateRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewStateRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewStateRequestData + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewStateRequestData + */ + public static CreateSceneViewStateRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewStateRequestData.class); + } + + /** + * Convert an instance of CreateSceneViewStateRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataAttributes.java index 92947d1..0981ad8 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataAttributes.java @@ -14,78 +14,94 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneViewStateRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewStateRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; - public CreateSceneViewStateRequestDataAttributes() { + public CreateSceneViewStateRequestDataAttributes() { } - public CreateSceneViewStateRequestDataAttributes name(String name) { - + public CreateSceneViewStateRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public CreateSceneViewStateRequestDataAttributes suppliedId(String suppliedId) { - + public CreateSceneViewStateRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,5 +141,96 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewStateRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewStateRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewStateRequestDataAttributes is not found in the empty JSON string", CreateSceneViewStateRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewStateRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewStateRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewStateRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewStateRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewStateRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewStateRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewStateRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewStateRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewStateRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewStateRequestDataAttributes + */ + public static CreateSceneViewStateRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewStateRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateSceneViewStateRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationships.java b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationships.java index d531d43..13c6e45 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationships.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.SceneViewRelationship; -import com.vertexvis.model.SceneViewStateRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.CreateSceneViewStateRequestDataRelationshipsSource; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateSceneViewStateRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateSceneViewStateRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) - private OneOfSceneViewRelationshipSceneViewStateRelationship source; + @javax.annotation.Nonnull + private CreateSceneViewStateRequestDataRelationshipsSource source; - public CreateSceneViewStateRequestDataRelationships() { + public CreateSceneViewStateRequestDataRelationships() { } - public CreateSceneViewStateRequestDataRelationships source(OneOfSceneViewRelationshipSceneViewStateRelationship source) { - + public CreateSceneViewStateRequestDataRelationships source(@javax.annotation.Nonnull CreateSceneViewStateRequestDataRelationshipsSource source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "") - - public OneOfSceneViewRelationshipSceneViewStateRelationship getSource() { + */ + @javax.annotation.Nonnull + public CreateSceneViewStateRequestDataRelationshipsSource getSource() { return source; } - - public void setSource(OneOfSceneViewRelationshipSceneViewStateRelationship source) { + public void setSource(@javax.annotation.Nonnull CreateSceneViewStateRequestDataRelationshipsSource source) { this.source = source; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewStateRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSceneViewStateRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSceneViewStateRequestDataRelationships is not found in the empty JSON string", CreateSceneViewStateRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSceneViewStateRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSceneViewStateRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSceneViewStateRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `source` + CreateSceneViewStateRequestDataRelationshipsSource.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewStateRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewStateRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSceneViewStateRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewStateRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSceneViewStateRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSceneViewStateRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewStateRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewStateRequestDataRelationships + */ + public static CreateSceneViewStateRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewStateRequestDataRelationships.class); + } + + /** + * Convert an instance of CreateSceneViewStateRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationshipsSource.java new file mode 100644 index 0000000..6c73498 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreateSceneViewStateRequestDataRelationshipsSource.java @@ -0,0 +1,276 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.SceneViewRelationship; +import com.vertexvis.model.SceneViewStateRelationship; +import com.vertexvis.model.SceneViewStateRelationshipData; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreateSceneViewStateRequestDataRelationshipsSource extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateSceneViewStateRequestDataRelationshipsSource.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSceneViewStateRequestDataRelationshipsSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSceneViewStateRequestDataRelationshipsSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterSceneViewRelationship = gson.getDelegateAdapter(this, TypeToken.get(SceneViewRelationship.class)); + final TypeAdapter adapterSceneViewStateRelationship = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSceneViewStateRequestDataRelationshipsSource value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `SceneViewRelationship` + if (value.getActualInstance() instanceof SceneViewRelationship) { + JsonElement element = adapterSceneViewRelationship.toJsonTree((SceneViewRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneViewStateRelationship` + if (value.getActualInstance() instanceof SceneViewStateRelationship) { + JsonElement element = adapterSceneViewStateRelationship.toJsonTree((SceneViewStateRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: SceneViewRelationship, SceneViewStateRelationship"); + } + + @Override + public CreateSceneViewStateRequestDataRelationshipsSource read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize SceneViewRelationship + try { + // validate the JSON object to see if any exception is thrown + SceneViewRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterSceneViewRelationship; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneViewRelationship'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneViewRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneViewRelationship'", e); + } + // deserialize SceneViewStateRelationship + try { + // validate the JSON object to see if any exception is thrown + SceneViewStateRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterSceneViewStateRelationship; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneViewStateRelationship'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneViewStateRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneViewStateRelationship'", e); + } + + if (match == 1) { + CreateSceneViewStateRequestDataRelationshipsSource ret = new CreateSceneViewStateRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateSceneViewStateRequestDataRelationshipsSource: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateSceneViewStateRequestDataRelationshipsSource() { + super("oneOf", Boolean.FALSE); + } + + public CreateSceneViewStateRequestDataRelationshipsSource(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SceneViewRelationship", SceneViewRelationship.class); + schemas.put("SceneViewStateRelationship", SceneViewStateRelationship.class); + } + + @Override + public Map> getSchemas() { + return CreateSceneViewStateRequestDataRelationshipsSource.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * SceneViewRelationship, SceneViewStateRelationship + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof SceneViewRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneViewStateRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be SceneViewRelationship, SceneViewStateRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * SceneViewRelationship, SceneViewStateRelationship + * + * @return The actual instance (SceneViewRelationship, SceneViewStateRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneViewRelationship`. If the actual instance is not `SceneViewRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneViewRelationship` + * @throws ClassCastException if the instance is not `SceneViewRelationship` + */ + public SceneViewRelationship getSceneViewRelationship() throws ClassCastException { + return (SceneViewRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneViewStateRelationship`. If the actual instance is not `SceneViewStateRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneViewStateRelationship` + * @throws ClassCastException if the instance is not `SceneViewStateRelationship` + */ + public SceneViewStateRelationship getSceneViewStateRelationship() throws ClassCastException { + return (SceneViewStateRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSceneViewStateRequestDataRelationshipsSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with SceneViewRelationship + try { + SceneViewRelationship.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneViewRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneViewStateRelationship + try { + SceneViewStateRelationship.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneViewStateRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateSceneViewStateRequestDataRelationshipsSource with oneOf schemas: SceneViewRelationship, SceneViewStateRelationship. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateSceneViewStateRequestDataRelationshipsSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSceneViewStateRequestDataRelationshipsSource + * @throws IOException if the JSON string is invalid with respect to CreateSceneViewStateRequestDataRelationshipsSource + */ + public static CreateSceneViewStateRequestDataRelationshipsSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSceneViewStateRequestDataRelationshipsSource.class); + } + + /** + * Convert an instance of CreateSceneViewStateRequestDataRelationshipsSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateStreamKeyRequest.java b/src/main/java/com/vertexvis/model/CreateStreamKeyRequest.java index aa151e7..78d3d8f 100644 --- a/src/main/java/com/vertexvis/model/CreateStreamKeyRequest.java +++ b/src/main/java/com/vertexvis/model/CreateStreamKeyRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateStreamKeyRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateStreamKeyRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateStreamKeyRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateStreamKeyRequestData data; - public CreateStreamKeyRequest() { + public CreateStreamKeyRequest() { } - public CreateStreamKeyRequest data(CreateStreamKeyRequestData data) { - + public CreateStreamKeyRequest data(@javax.annotation.Nonnull CreateStreamKeyRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateStreamKeyRequestData getData() { return data; } - - public void setData(CreateStreamKeyRequestData data) { + public void setData(@javax.annotation.Nonnull CreateStreamKeyRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateStreamKeyRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateStreamKeyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateStreamKeyRequest is not found in the empty JSON string", CreateStreamKeyRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateStreamKeyRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateStreamKeyRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateStreamKeyRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateStreamKeyRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateStreamKeyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateStreamKeyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateStreamKeyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateStreamKeyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateStreamKeyRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateStreamKeyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateStreamKeyRequest + * @throws IOException if the JSON string is invalid with respect to CreateStreamKeyRequest + */ + public static CreateStreamKeyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateStreamKeyRequest.class); + } + + /** + * Convert an instance of CreateStreamKeyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateStreamKeyRequestData.java b/src/main/java/com/vertexvis/model/CreateStreamKeyRequestData.java index 18b6558..ccfe837 100644 --- a/src/main/java/com/vertexvis/model/CreateStreamKeyRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateStreamKeyRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateStreamKeyRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateStreamKeyRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateStreamKeyRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateStreamKeyRequestDataAttributes attributes; - public CreateStreamKeyRequestData() { + public CreateStreamKeyRequestData() { } - public CreateStreamKeyRequestData type(String type) { - + public CreateStreamKeyRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "stream-key", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateStreamKeyRequestData attributes(CreateStreamKeyRequestDataAttributes attributes) { - + public CreateStreamKeyRequestData attributes(@javax.annotation.Nonnull CreateStreamKeyRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateStreamKeyRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateStreamKeyRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateStreamKeyRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateStreamKeyRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateStreamKeyRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateStreamKeyRequestData is not found in the empty JSON string", CreateStreamKeyRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateStreamKeyRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateStreamKeyRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateStreamKeyRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateStreamKeyRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateStreamKeyRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateStreamKeyRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateStreamKeyRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateStreamKeyRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateStreamKeyRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateStreamKeyRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateStreamKeyRequestData + * @throws IOException if the JSON string is invalid with respect to CreateStreamKeyRequestData + */ + public static CreateStreamKeyRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateStreamKeyRequestData.class); + } + + /** + * Convert an instance of CreateStreamKeyRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateStreamKeyRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateStreamKeyRequestDataAttributes.java index 41c49be..343244f 100644 --- a/src/main/java/com/vertexvis/model/CreateStreamKeyRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateStreamKeyRequestDataAttributes.java @@ -14,80 +14,96 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateStreamKeyRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateStreamKeyRequestDataAttributes { public static final String SERIALIZED_NAME_EXPIRY = "expiry"; @SerializedName(SERIALIZED_NAME_EXPIRY) + @javax.annotation.Nullable private Integer expiry; public static final String SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS = "excludePrunedItems"; @SerializedName(SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS) + @javax.annotation.Nullable private Boolean excludePrunedItems; - public CreateStreamKeyRequestDataAttributes() { + public CreateStreamKeyRequestDataAttributes() { } - public CreateStreamKeyRequestDataAttributes expiry(Integer expiry) { - + public CreateStreamKeyRequestDataAttributes expiry(@javax.annotation.Nullable Integer expiry) { this.expiry = expiry; return this; } - /** + /** * Number of seconds before the `stream-key` expires. * minimum: 1 * maximum: 31557600 * @return expiry - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "600", value = "Number of seconds before the `stream-key` expires.") - public Integer getExpiry() { return expiry; } - - public void setExpiry(Integer expiry) { + public void setExpiry(@javax.annotation.Nullable Integer expiry) { this.expiry = expiry; } - public CreateStreamKeyRequestDataAttributes excludePrunedItems(Boolean excludePrunedItems) { - + public CreateStreamKeyRequestDataAttributes excludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; return this; } - /** + /** * Whether to exclude non-visible items in the view * @return excludePrunedItems - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Whether to exclude non-visible items in the view") - public Boolean getExcludePrunedItems() { return excludePrunedItems; } - - public void setExcludePrunedItems(Boolean excludePrunedItems) { + public void setExcludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,90 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiry"); + openapiFields.add("excludePrunedItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateStreamKeyRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateStreamKeyRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateStreamKeyRequestDataAttributes is not found in the empty JSON string", CreateStreamKeyRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateStreamKeyRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateStreamKeyRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateStreamKeyRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateStreamKeyRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateStreamKeyRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateStreamKeyRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateStreamKeyRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateStreamKeyRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateStreamKeyRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateStreamKeyRequestDataAttributes + */ + public static CreateStreamKeyRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateStreamKeyRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateStreamKeyRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequest.java b/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequest.java index 5a4eba2..db7d2e3 100644 --- a/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequest.java +++ b/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateTranslationInspectionRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateTranslationInspectionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateTranslationInspectionRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateTranslationInspectionRequestData data; - public CreateTranslationInspectionRequest() { + public CreateTranslationInspectionRequest() { } - public CreateTranslationInspectionRequest data(CreateTranslationInspectionRequestData data) { - + public CreateTranslationInspectionRequest data(@javax.annotation.Nonnull CreateTranslationInspectionRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateTranslationInspectionRequestData getData() { return data; } - - public void setData(CreateTranslationInspectionRequestData data) { + public void setData(@javax.annotation.Nonnull CreateTranslationInspectionRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTranslationInspectionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTranslationInspectionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTranslationInspectionRequest is not found in the empty JSON string", CreateTranslationInspectionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTranslationInspectionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTranslationInspectionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTranslationInspectionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateTranslationInspectionRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTranslationInspectionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTranslationInspectionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTranslationInspectionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTranslationInspectionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTranslationInspectionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTranslationInspectionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTranslationInspectionRequest + * @throws IOException if the JSON string is invalid with respect to CreateTranslationInspectionRequest + */ + public static CreateTranslationInspectionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTranslationInspectionRequest.class); + } + + /** + * Convert an instance of CreateTranslationInspectionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequestData.java b/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequestData.java index fa664e1..e5e1543 100644 --- a/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateTranslationInspectionRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateGeometrySetRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateTranslationInspectionRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateTranslationInspectionRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private CreateGeometrySetRequestDataRelationships relationships; - public CreateTranslationInspectionRequestData() { + public CreateTranslationInspectionRequestData() { } - public CreateTranslationInspectionRequestData type(String type) { - + public CreateTranslationInspectionRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "translation-inspection", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateTranslationInspectionRequestData relationships(CreateGeometrySetRequestDataRelationships relationships) { - + public CreateTranslationInspectionRequestData relationships(@javax.annotation.Nonnull CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateGeometrySetRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateGeometrySetRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull CreateGeometrySetRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTranslationInspectionRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTranslationInspectionRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTranslationInspectionRequestData is not found in the empty JSON string", CreateTranslationInspectionRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTranslationInspectionRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTranslationInspectionRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTranslationInspectionRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `relationships` + CreateGeometrySetRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTranslationInspectionRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTranslationInspectionRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTranslationInspectionRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTranslationInspectionRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTranslationInspectionRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTranslationInspectionRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTranslationInspectionRequestData + * @throws IOException if the JSON string is invalid with respect to CreateTranslationInspectionRequestData + */ + public static CreateTranslationInspectionRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTranslationInspectionRequestData.class); + } + + /** + * Convert an instance of CreateTranslationInspectionRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequest.java b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequest.java index af56e4b..ff25e1e 100644 --- a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequest.java +++ b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateWebhookSubscriptionRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateWebhookSubscriptionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateWebhookSubscriptionRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreateWebhookSubscriptionRequestData data; - public CreateWebhookSubscriptionRequest() { + public CreateWebhookSubscriptionRequest() { } - public CreateWebhookSubscriptionRequest data(CreateWebhookSubscriptionRequestData data) { - + public CreateWebhookSubscriptionRequest data(@javax.annotation.Nonnull CreateWebhookSubscriptionRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateWebhookSubscriptionRequestData getData() { return data; } - - public void setData(CreateWebhookSubscriptionRequestData data) { + public void setData(@javax.annotation.Nonnull CreateWebhookSubscriptionRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhookSubscriptionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhookSubscriptionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhookSubscriptionRequest is not found in the empty JSON string", CreateWebhookSubscriptionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhookSubscriptionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhookSubscriptionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWebhookSubscriptionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateWebhookSubscriptionRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhookSubscriptionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhookSubscriptionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhookSubscriptionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhookSubscriptionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhookSubscriptionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhookSubscriptionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhookSubscriptionRequest + * @throws IOException if the JSON string is invalid with respect to CreateWebhookSubscriptionRequest + */ + public static CreateWebhookSubscriptionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhookSubscriptionRequest.class); + } + + /** + * Convert an instance of CreateWebhookSubscriptionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestData.java b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestData.java index 727d184..44e1296 100644 --- a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestData.java +++ b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateWebhookSubscriptionRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateWebhookSubscriptionRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateWebhookSubscriptionRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateWebhookSubscriptionRequestDataAttributes attributes; - public CreateWebhookSubscriptionRequestData() { + public CreateWebhookSubscriptionRequestData() { } - public CreateWebhookSubscriptionRequestData type(String type) { - + public CreateWebhookSubscriptionRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "webhook-subscription", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreateWebhookSubscriptionRequestData attributes(CreateWebhookSubscriptionRequestDataAttributes attributes) { - + public CreateWebhookSubscriptionRequestData attributes(@javax.annotation.Nonnull CreateWebhookSubscriptionRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateWebhookSubscriptionRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateWebhookSubscriptionRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateWebhookSubscriptionRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhookSubscriptionRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhookSubscriptionRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhookSubscriptionRequestData is not found in the empty JSON string", CreateWebhookSubscriptionRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhookSubscriptionRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhookSubscriptionRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWebhookSubscriptionRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateWebhookSubscriptionRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhookSubscriptionRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhookSubscriptionRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhookSubscriptionRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhookSubscriptionRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhookSubscriptionRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhookSubscriptionRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhookSubscriptionRequestData + * @throws IOException if the JSON string is invalid with respect to CreateWebhookSubscriptionRequestData + */ + public static CreateWebhookSubscriptionRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhookSubscriptionRequestData.class); + } + + /** + * Convert an instance of CreateWebhookSubscriptionRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestDataAttributes.java index a15dfc8..7f1dce4 100644 --- a/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateWebhookSubscriptionRequestDataAttributes.java @@ -14,85 +14,104 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreateWebhookSubscriptionRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreateWebhookSubscriptionRequestDataAttributes { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull private String url; public static final String SERIALIZED_NAME_TOPICS = "topics"; @SerializedName(SERIALIZED_NAME_TOPICS) + @javax.annotation.Nonnull private List topics = new ArrayList<>(); - public CreateWebhookSubscriptionRequestDataAttributes() { + public CreateWebhookSubscriptionRequestDataAttributes() { } - public CreateWebhookSubscriptionRequestDataAttributes url(String url) { - + public CreateWebhookSubscriptionRequestDataAttributes url(@javax.annotation.Nonnull String url) { this.url = url; return this; } - /** + /** * Get url * @return url - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getUrl() { return url; } - - public void setUrl(String url) { + public void setUrl(@javax.annotation.Nonnull String url) { this.url = url; } - public CreateWebhookSubscriptionRequestDataAttributes topics(List topics) { - + public CreateWebhookSubscriptionRequestDataAttributes topics(@javax.annotation.Nonnull List topics) { this.topics = topics; return this; } public CreateWebhookSubscriptionRequestDataAttributes addTopicsItem(String topicsItem) { + if (this.topics == null) { + this.topics = new ArrayList<>(); + } this.topics.add(topicsItem); return this; } - /** + /** * Get topics * @return topics - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getTopics() { return topics; } - - public void setTopics(List topics) { + public void setTopics(@javax.annotation.Nonnull List topics) { this.topics = topics; } + @Override public boolean equals(Object o) { if (this == o) { @@ -132,5 +151,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("topics"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("topics"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhookSubscriptionRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhookSubscriptionRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhookSubscriptionRequestDataAttributes is not found in the empty JSON string", CreateWebhookSubscriptionRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhookSubscriptionRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhookSubscriptionRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWebhookSubscriptionRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + // ensure the required json array is present + if (jsonObj.get("topics") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("topics").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `topics` to be an array in the JSON string but got `%s`", jsonObj.get("topics").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhookSubscriptionRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhookSubscriptionRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhookSubscriptionRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhookSubscriptionRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhookSubscriptionRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhookSubscriptionRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhookSubscriptionRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateWebhookSubscriptionRequestDataAttributes + */ + public static CreateWebhookSubscriptionRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhookSubscriptionRequestDataAttributes.class); + } + + /** + * Convert an instance of CreateWebhookSubscriptionRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatedApplication.java b/src/main/java/com/vertexvis/model/CreatedApplication.java index e12509a..8ca322a 100644 --- a/src/main/java/com/vertexvis/model/CreatedApplication.java +++ b/src/main/java/com/vertexvis/model/CreatedApplication.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreatedApplicationData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CreatedApplication */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatedApplication { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private CreatedApplicationData data; - public CreatedApplication() { + public CreatedApplication() { } - public CreatedApplication data(CreatedApplicationData data) { - + public CreatedApplication data(@javax.annotation.Nonnull CreatedApplicationData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatedApplicationData getData() { return data; } - - public void setData(CreatedApplicationData data) { + public void setData(@javax.annotation.Nonnull CreatedApplicationData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatedApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatedApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatedApplication is not found in the empty JSON string", CreatedApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatedApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatedApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatedApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreatedApplicationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatedApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatedApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatedApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatedApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatedApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatedApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatedApplication + * @throws IOException if the JSON string is invalid with respect to CreatedApplication + */ + public static CreatedApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatedApplication.class); + } + + /** + * Convert an instance of CreatedApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatedApplicationData.java b/src/main/java/com/vertexvis/model/CreatedApplicationData.java index 9719583..1b89af0 100644 --- a/src/main/java/com/vertexvis/model/CreatedApplicationData.java +++ b/src/main/java/com/vertexvis/model/CreatedApplicationData.java @@ -14,107 +14,120 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreatedApplicationDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreatedApplicationData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatedApplicationData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreatedApplicationDataAttributes attributes; - public CreatedApplicationData() { + public CreatedApplicationData() { } - public CreatedApplicationData type(String type) { - + public CreatedApplicationData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "application", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public CreatedApplicationData id(UUID id) { - + public CreatedApplicationData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public CreatedApplicationData attributes(CreatedApplicationDataAttributes attributes) { - + public CreatedApplicationData attributes(@javax.annotation.Nonnull CreatedApplicationDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreatedApplicationDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreatedApplicationDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreatedApplicationDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatedApplicationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatedApplicationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatedApplicationData is not found in the empty JSON string", CreatedApplicationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatedApplicationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatedApplicationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatedApplicationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + CreatedApplicationDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatedApplicationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatedApplicationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatedApplicationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatedApplicationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatedApplicationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatedApplicationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatedApplicationData + * @throws IOException if the JSON string is invalid with respect to CreatedApplicationData + */ + public static CreatedApplicationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatedApplicationData.class); + } + + /** + * Convert an instance of CreatedApplicationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CreatedApplicationDataAttributes.java b/src/main/java/com/vertexvis/model/CreatedApplicationDataAttributes.java index 237cfa4..66d7952 100644 --- a/src/main/java/com/vertexvis/model/CreatedApplicationDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreatedApplicationDataAttributes.java @@ -14,199 +14,209 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * CreatedApplicationDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CreatedApplicationDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_CLIENT_ID = "clientId"; @SerializedName(SERIALIZED_NAME_CLIENT_ID) + @javax.annotation.Nonnull private String clientId; public static final String SERIALIZED_NAME_SECRET = "secret"; @SerializedName(SERIALIZED_NAME_SECRET) + @javax.annotation.Nonnull private String secret; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_SCOPES = "scopes"; @SerializedName(SERIALIZED_NAME_SCOPES) + @javax.annotation.Nonnull private List scopes = new ArrayList<>(); public static final String SERIALIZED_NAME_REDIRECT_URIS = "redirect_uris"; @SerializedName(SERIALIZED_NAME_REDIRECT_URIS) + @javax.annotation.Nonnull private List redirectUris = new ArrayList<>(); - public CreatedApplicationDataAttributes() { + public CreatedApplicationDataAttributes() { } - public CreatedApplicationDataAttributes name(String name) { - + public CreatedApplicationDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public CreatedApplicationDataAttributes clientId(String clientId) { - + public CreatedApplicationDataAttributes clientId(@javax.annotation.Nonnull String clientId) { this.clientId = clientId; return this; } - /** + /** * Get clientId * @return clientId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getClientId() { return clientId; } - - public void setClientId(String clientId) { + public void setClientId(@javax.annotation.Nonnull String clientId) { this.clientId = clientId; } - public CreatedApplicationDataAttributes secret(String secret) { - + public CreatedApplicationDataAttributes secret(@javax.annotation.Nonnull String secret) { this.secret = secret; return this; } - /** + /** * Get secret * @return secret - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getSecret() { return secret; } - - public void setSecret(String secret) { + public void setSecret(@javax.annotation.Nonnull String secret) { this.secret = secret; } - public CreatedApplicationDataAttributes created(OffsetDateTime created) { - + public CreatedApplicationDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public CreatedApplicationDataAttributes scopes(List scopes) { - + public CreatedApplicationDataAttributes scopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; return this; } public CreatedApplicationDataAttributes addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } this.scopes.add(scopesItem); return this; } - /** + /** * Get scopes * @return scopes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getScopes() { return scopes; } - - public void setScopes(List scopes) { + public void setScopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; } - public CreatedApplicationDataAttributes redirectUris(List redirectUris) { - + public CreatedApplicationDataAttributes redirectUris(@javax.annotation.Nonnull List redirectUris) { this.redirectUris = redirectUris; return this; } public CreatedApplicationDataAttributes addRedirectUrisItem(String redirectUrisItem) { + if (this.redirectUris == null) { + this.redirectUris = new ArrayList<>(); + } this.redirectUris.add(redirectUrisItem); return this; } - /** + /** * Get redirectUris * @return redirectUris - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getRedirectUris() { return redirectUris; } - - public void setRedirectUris(List redirectUris) { + public void setRedirectUris(@javax.annotation.Nonnull List redirectUris) { this.redirectUris = redirectUris; } + @Override public boolean equals(Object o) { if (this == o) { @@ -254,5 +264,128 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("clientId"); + openapiFields.add("secret"); + openapiFields.add("created"); + openapiFields.add("scopes"); + openapiFields.add("redirect_uris"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("clientId"); + openapiRequiredFields.add("secret"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("scopes"); + openapiRequiredFields.add("redirect_uris"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatedApplicationDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatedApplicationDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatedApplicationDataAttributes is not found in the empty JSON string", CreatedApplicationDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatedApplicationDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatedApplicationDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatedApplicationDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("clientId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientId").toString())); + } + if (!jsonObj.get("secret").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secret` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secret").toString())); + } + // ensure the required json array is present + if (jsonObj.get("scopes") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("scopes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scopes` to be an array in the JSON string but got `%s`", jsonObj.get("scopes").toString())); + } + // ensure the required json array is present + if (jsonObj.get("redirect_uris") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("redirect_uris").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `redirect_uris` to be an array in the JSON string but got `%s`", jsonObj.get("redirect_uris").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatedApplicationDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatedApplicationDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatedApplicationDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatedApplicationDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatedApplicationDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatedApplicationDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatedApplicationDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreatedApplicationDataAttributes + */ + public static CreatedApplicationDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatedApplicationDataAttributes.class); + } + + /** + * Convert an instance of CreatedApplicationDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/CrossSectioning.java b/src/main/java/com/vertexvis/model/CrossSectioning.java index 08034a0..59f6e90 100644 --- a/src/main/java/com/vertexvis/model/CrossSectioning.java +++ b/src/main/java/com/vertexvis/model/CrossSectioning.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SectionPlane; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * CrossSectioning */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class CrossSectioning { public static final String SERIALIZED_NAME_PLANES = "planes"; @SerializedName(SERIALIZED_NAME_PLANES) + @javax.annotation.Nonnull private List planes = new ArrayList<>(); - public CrossSectioning() { + public CrossSectioning() { } - public CrossSectioning planes(List planes) { - + public CrossSectioning planes(@javax.annotation.Nonnull List planes) { this.planes = planes; return this; } public CrossSectioning addPlanesItem(SectionPlane planesItem) { + if (this.planes == null) { + this.planes = new ArrayList<>(); + } this.planes.add(planesItem); return this; } - /** + /** * Get planes * @return planes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getPlanes() { return planes; } - - public void setPlanes(List planes) { + public void setPlanes(@javax.annotation.Nonnull List planes) { this.planes = planes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("planes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("planes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CrossSectioning + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CrossSectioning.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CrossSectioning is not found in the empty JSON string", CrossSectioning.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CrossSectioning.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CrossSectioning` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CrossSectioning.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("planes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `planes` to be an array in the JSON string but got `%s`", jsonObj.get("planes").toString())); + } + + JsonArray jsonArrayplanes = jsonObj.getAsJsonArray("planes"); + // validate the required field `planes` (array) + for (int i = 0; i < jsonArrayplanes.size(); i++) { + SectionPlane.validateJsonElement(jsonArrayplanes.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CrossSectioning.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CrossSectioning' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CrossSectioning.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CrossSectioning value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CrossSectioning read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CrossSectioning given an JSON string + * + * @param jsonString JSON string + * @return An instance of CrossSectioning + * @throws IOException if the JSON string is invalid with respect to CrossSectioning + */ + public static CrossSectioning fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CrossSectioning.class); + } + + /** + * Convert an instance of CrossSectioning to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/DeselectOperation.java b/src/main/java/com/vertexvis/model/DeselectOperation.java index d3209b3..48aac4c 100644 --- a/src/main/java/com/vertexvis/model/DeselectOperation.java +++ b/src/main/java/com/vertexvis/model/DeselectOperation.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * DeselectOperation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class DeselectOperation { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public DeselectOperation() { + public DeselectOperation() { } - public DeselectOperation type(TypeEnum type) { - + public DeselectOperation type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "deselect", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeselectOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeselectOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeselectOperation is not found in the empty JSON string", DeselectOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeselectOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeselectOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeselectOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeselectOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeselectOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeselectOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeselectOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeselectOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeselectOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeselectOperation + * @throws IOException if the JSON string is invalid with respect to DeselectOperation + */ + public static DeselectOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeselectOperation.class); + } + + /** + * Convert an instance of DeselectOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Dimensions.java b/src/main/java/com/vertexvis/model/Dimensions.java index a55e272..76440eb 100644 --- a/src/main/java/com/vertexvis/model/Dimensions.java +++ b/src/main/java/com/vertexvis/model/Dimensions.java @@ -14,79 +14,94 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * An item's height and width. */ -@ApiModel(description = "An item's height and width.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Dimensions { public static final String SERIALIZED_NAME_HEIGHT = "height"; @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nonnull private Integer height; public static final String SERIALIZED_NAME_WIDTH = "width"; @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nonnull private Integer width; - public Dimensions() { + public Dimensions() { } - public Dimensions height(Integer height) { - + public Dimensions height(@javax.annotation.Nonnull Integer height) { this.height = height; return this; } - /** + /** * Item's height. * @return height - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "10", required = true, value = "Item's height.") - public Integer getHeight() { return height; } - - public void setHeight(Integer height) { + public void setHeight(@javax.annotation.Nonnull Integer height) { this.height = height; } - public Dimensions width(Integer width) { - + public Dimensions width(@javax.annotation.Nonnull Integer width) { this.width = width; return this; } - /** + /** * Item's width. * @return width - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "10", required = true, value = "Item's width.") - public Integer getWidth() { return width; } - - public void setWidth(Integer width) { + public void setWidth(@javax.annotation.Nonnull Integer width) { this.width = width; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +141,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("height"); + openapiFields.add("width"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("height"); + openapiRequiredFields.add("width"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dimensions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dimensions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Dimensions is not found in the empty JSON string", Dimensions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Dimensions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Dimensions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dimensions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dimensions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dimensions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dimensions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dimensions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Dimensions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dimensions given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dimensions + * @throws IOException if the JSON string is invalid with respect to Dimensions + */ + public static Dimensions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dimensions.class); + } + + /** + * Convert an instance of Dimensions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Export.java b/src/main/java/com/vertexvis/model/Export.java index c349583..8b37b07 100644 --- a/src/main/java/com/vertexvis/model/Export.java +++ b/src/main/java/com/vertexvis/model/Export.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Export */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Export { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private ExportData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Export() { + public Export() { } - public Export data(ExportData data) { - + public Export data(@javax.annotation.Nonnull ExportData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ExportData getData() { return data; } - - public void setData(ExportData data) { + public void setData(@javax.annotation.Nonnull ExportData data) { this.data = data; } - public Export links(Map links) { - + public Export links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public Export putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Export + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Export.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Export is not found in the empty JSON string", Export.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Export.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Export` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Export.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ExportData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Export.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Export' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Export.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Export value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Export read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Export given an JSON string + * + * @param jsonString JSON string + * @return An instance of Export + * @throws IOException if the JSON string is invalid with respect to Export + */ + public static Export fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Export.class); + } + + /** + * Convert an instance of Export to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportConfig.java b/src/main/java/com/vertexvis/model/ExportConfig.java index e823a49..886031f 100644 --- a/src/main/java/com/vertexvis/model/ExportConfig.java +++ b/src/main/java/com/vertexvis/model/ExportConfig.java @@ -14,54 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.CADExportConfig; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Describes the options for configuring a file export. */ -@ApiModel(description = "Describes the options for configuring a file export.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportConfig { public static final String SERIALIZED_NAME_FORMAT = "format"; @SerializedName(SERIALIZED_NAME_FORMAT) + @javax.annotation.Nonnull protected String format; - public ExportConfig() { + public ExportConfig() { this.format = this.getClass().getSimpleName(); } - public ExportConfig format(String format) { - + public ExportConfig format(@javax.annotation.Nonnull String format) { this.format = format; return this; } - /** + /** * Get format * @return format - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "jt", required = true, value = "") - public String getFormat() { return format; } - - public void setFormat(String format) { + public void setFormat(@javax.annotation.Nonnull String format) { this.format = format; } + @Override public boolean equals(Object o) { if (this == o) { @@ -99,5 +116,62 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("format"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportConfig is not found in the empty JSON string", ExportConfig.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("format").getAsString(); + switch (discriminatorValue) { + case "CADExportConfig": + CADExportConfig.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `format` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of ExportConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportConfig + * @throws IOException if the JSON string is invalid with respect to ExportConfig + */ + public static ExportConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportConfig.class); + } + + /** + * Convert an instance of ExportConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportData.java b/src/main/java/com/vertexvis/model/ExportData.java index c6f5522..1476ae7 100644 --- a/src/main/java/com/vertexvis/model/ExportData.java +++ b/src/main/java/com/vertexvis/model/ExportData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportDataAttributes; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ExportData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private ExportDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public ExportData() { + public ExportData() { } - public ExportData type(String type) { - + public ExportData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "export", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public ExportData id(UUID id) { - + public ExportData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public ExportData attributes(ExportDataAttributes attributes) { - + public ExportData attributes(@javax.annotation.Nonnull ExportDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ExportDataAttributes getAttributes() { return attributes; } - - public void setAttributes(ExportDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull ExportDataAttributes attributes) { this.attributes = attributes; } - public ExportData links(Map links) { - + public ExportData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public ExportData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportData is not found in the empty JSON string", ExportData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + ExportDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportData + * @throws IOException if the JSON string is invalid with respect to ExportData + */ + public static ExportData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportData.class); + } + + /** + * Convert an instance of ExportData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportDataAttributes.java b/src/main/java/com/vertexvis/model/ExportDataAttributes.java index 73d81c0..b936f26 100644 --- a/src/main/java/com/vertexvis/model/ExportDataAttributes.java +++ b/src/main/java/com/vertexvis/model/ExportDataAttributes.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * ExportDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_DOWNLOAD_URL = "downloadUrl"; @SerializedName(SERIALIZED_NAME_DOWNLOAD_URL) + @javax.annotation.Nonnull private String downloadUrl; - public ExportDataAttributes() { + public ExportDataAttributes() { } - public ExportDataAttributes created(OffsetDateTime created) { - + public ExportDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public ExportDataAttributes downloadUrl(String downloadUrl) { - + public ExportDataAttributes downloadUrl(@javax.annotation.Nonnull String downloadUrl) { this.downloadUrl = downloadUrl; return this; } - /** + /** * Get downloadUrl * @return downloadUrl - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "https://example.com/path/to/file.jt", required = true, value = "") - public String getDownloadUrl() { return downloadUrl; } - - public void setDownloadUrl(String downloadUrl) { + public void setDownloadUrl(@javax.annotation.Nonnull String downloadUrl) { this.downloadUrl = downloadUrl; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("downloadUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("downloadUrl"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportDataAttributes is not found in the empty JSON string", ExportDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("downloadUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `downloadUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("downloadUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportDataAttributes + * @throws IOException if the JSON string is invalid with respect to ExportDataAttributes + */ + public static ExportDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportDataAttributes.class); + } + + /** + * Convert an instance of ExportDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportRelationship.java b/src/main/java/com/vertexvis/model/ExportRelationship.java index 869f7fe..57fa111 100644 --- a/src/main/java/com/vertexvis/model/ExportRelationship.java +++ b/src/main/java/com/vertexvis/model/ExportRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to an `export`. */ -@ApiModel(description = "Relationship to an `export`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private ExportRelationshipData data; - public ExportRelationship() { + public ExportRelationship() { } - public ExportRelationship data(ExportRelationshipData data) { - + public ExportRelationship data(@javax.annotation.Nonnull ExportRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ExportRelationshipData getData() { return data; } - - public void setData(ExportRelationshipData data) { + public void setData(@javax.annotation.Nonnull ExportRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportRelationship is not found in the empty JSON string", ExportRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ExportRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportRelationship + * @throws IOException if the JSON string is invalid with respect to ExportRelationship + */ + public static ExportRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportRelationship.class); + } + + /** + * Convert an instance of ExportRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportRelationshipData.java b/src/main/java/com/vertexvis/model/ExportRelationshipData.java index d9eef84..db66421 100644 --- a/src/main/java/com/vertexvis/model/ExportRelationshipData.java +++ b/src/main/java/com/vertexvis/model/ExportRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ExportRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public ExportRelationshipData() { + public ExportRelationshipData() { } - public ExportRelationshipData type(TypeEnum type) { - + public ExportRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ExportRelationshipData id(UUID id) { - + public ExportRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportRelationshipData is not found in the empty JSON string", ExportRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportRelationshipData + * @throws IOException if the JSON string is invalid with respect to ExportRelationshipData + */ + public static ExportRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportRelationshipData.class); + } + + /** + * Convert an instance of ExportRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportStateRelationship.java b/src/main/java/com/vertexvis/model/ExportStateRelationship.java index b8e6f32..f1a74e7 100644 --- a/src/main/java/com/vertexvis/model/ExportStateRelationship.java +++ b/src/main/java/com/vertexvis/model/ExportStateRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ExportStateRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to an `export`. */ -@ApiModel(description = "Relationship to an `export`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportStateRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private ExportStateRelationshipData data; - public ExportStateRelationship() { + public ExportStateRelationship() { } - public ExportStateRelationship data(ExportStateRelationshipData data) { - + public ExportStateRelationship data(@javax.annotation.Nonnull ExportStateRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public ExportStateRelationshipData getData() { return data; } - - public void setData(ExportStateRelationshipData data) { + public void setData(@javax.annotation.Nonnull ExportStateRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportStateRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportStateRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportStateRelationship is not found in the empty JSON string", ExportStateRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportStateRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportStateRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportStateRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ExportStateRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportStateRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportStateRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportStateRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportStateRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportStateRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportStateRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportStateRelationship + * @throws IOException if the JSON string is invalid with respect to ExportStateRelationship + */ + public static ExportStateRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportStateRelationship.class); + } + + /** + * Convert an instance of ExportStateRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ExportStateRelationshipData.java b/src/main/java/com/vertexvis/model/ExportStateRelationshipData.java index 3ae7a5f..b35610e 100644 --- a/src/main/java/com/vertexvis/model/ExportStateRelationshipData.java +++ b/src/main/java/com/vertexvis/model/ExportStateRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ExportStateRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ExportStateRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public ExportStateRelationshipData() { + public ExportStateRelationshipData() { } - public ExportStateRelationshipData type(TypeEnum type) { - + public ExportStateRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view-state", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ExportStateRelationshipData id(UUID id) { - + public ExportStateRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExportStateRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExportStateRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExportStateRelationshipData is not found in the empty JSON string", ExportStateRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExportStateRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExportStateRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExportStateRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExportStateRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExportStateRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExportStateRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExportStateRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExportStateRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExportStateRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExportStateRelationshipData + * @throws IOException if the JSON string is invalid with respect to ExportStateRelationshipData + */ + public static ExportStateRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExportStateRelationshipData.class); + } + + /** + * Convert an instance of ExportStateRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Failure.java b/src/main/java/com/vertexvis/model/Failure.java index a217cef..0c158cb 100644 --- a/src/main/java/com/vertexvis/model/Failure.java +++ b/src/main/java/com/vertexvis/model/Failure.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,65 +21,87 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApiError; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import com.vertexvis.JSON; + /** * Failure */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Failure { public static final String SERIALIZED_NAME_ERRORS = "errors"; @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull private Set errors = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_META = "meta"; @SerializedName(SERIALIZED_NAME_META) - private Map meta = null; + @javax.annotation.Nullable + private Map meta = new HashMap<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Failure() { + public Failure() { } - public Failure errors(Set errors) { - + public Failure errors(@javax.annotation.Nonnull Set errors) { this.errors = errors; return this; } public Failure addErrorsItem(ApiError errorsItem) { + if (this.errors == null) { + this.errors = new LinkedHashSet<>(); + } this.errors.add(errorsItem); return this; } - /** + /** * Get errors * @return errors - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Set getErrors() { return errors; } - - public void setErrors(Set errors) { + public void setErrors(@javax.annotation.Nonnull Set errors) { this.errors = errors; } - public Failure meta(Map meta) { - + public Failure meta(@javax.annotation.Nullable Map meta) { this.meta = meta; return this; } @@ -93,25 +114,21 @@ public Failure putMetaItem(String key, String metaItem) { return this; } - /** + /** * Get meta * @return meta - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getMeta() { return meta; } - - public void setMeta(Map meta) { + public void setMeta(@javax.annotation.Nullable Map meta) { this.meta = meta; } - public Failure links(Map links) { - + public Failure links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -124,23 +141,21 @@ public Failure putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -182,5 +197,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + openapiFields.add("meta"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("errors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Failure + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Failure.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Failure is not found in the empty JSON string", Failure.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Failure.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Failure` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Failure.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ApiError.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Failure.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Failure' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Failure.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Failure value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Failure read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Failure given an JSON string + * + * @param jsonString JSON string + * @return An instance of Failure + * @throws IOException if the JSON string is invalid with respect to Failure + */ + public static Failure fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Failure.class); + } + + /** + * Convert an instance of Failure to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FeatureLines.java b/src/main/java/com/vertexvis/model/FeatureLines.java index 80d38d1..94ed98a 100644 --- a/src/main/java/com/vertexvis/model/FeatureLines.java +++ b/src/main/java/com/vertexvis/model/FeatureLines.java @@ -14,80 +14,96 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Color3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * FeatureLines */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FeatureLines { public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nonnull private Color3 color; public static final String SERIALIZED_NAME_WIDTH = "width"; @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nonnull private BigDecimal width; - public FeatureLines() { + public FeatureLines() { } - public FeatureLines color(Color3 color) { - + public FeatureLines color(@javax.annotation.Nonnull Color3 color) { this.color = color; return this; } - /** + /** * Get color * @return color - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Color3 getColor() { return color; } - - public void setColor(Color3 color) { + public void setColor(@javax.annotation.Nonnull Color3 color) { this.color = color; } - public FeatureLines width(BigDecimal width) { - + public FeatureLines width(@javax.annotation.Nonnull BigDecimal width) { this.width = width; return this; } - /** + /** * Get width * @return width - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public BigDecimal getWidth() { return width; } - - public void setWidth(BigDecimal width) { + public void setWidth(@javax.annotation.Nonnull BigDecimal width) { this.width = width; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,101 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("color"); + openapiFields.add("width"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("color"); + openapiRequiredFields.add("width"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeatureLines + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeatureLines.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeatureLines is not found in the empty JSON string", FeatureLines.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeatureLines.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeatureLines` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeatureLines.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `color` + Color3.validateJsonElement(jsonObj.get("color")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeatureLines.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeatureLines' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeatureLines.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeatureLines value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeatureLines read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeatureLines given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeatureLines + * @throws IOException if the JSON string is invalid with respect to FeatureLines + */ + public static FeatureLines fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeatureLines.class); + } + + /** + * Convert an instance of FeatureLines to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileList.java b/src/main/java/com/vertexvis/model/FileList.java index 32da174..98e5eaf 100644 --- a/src/main/java/com/vertexvis/model/FileList.java +++ b/src/main/java/com/vertexvis/model/FileList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.FileMetadataData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * FileList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public FileList() { + public FileList() { } - public FileList data(List data) { - + public FileList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public FileList addDataItem(FileMetadataData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public FileList links(Map links) { - + public FileList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public FileList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileList is not found in the empty JSON string", FileList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + FileMetadataData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileList given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileList + * @throws IOException if the JSON string is invalid with respect to FileList + */ + public static FileList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileList.class); + } + + /** + * Convert an instance of FileList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileMetadata.java b/src/main/java/com/vertexvis/model/FileMetadata.java index ddf1faa..1c947e5 100644 --- a/src/main/java/com/vertexvis/model/FileMetadata.java +++ b/src/main/java/com/vertexvis/model/FileMetadata.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.FileMetadataData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * FileMetadata */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileMetadata { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private FileMetadataData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public FileMetadata() { + public FileMetadata() { } - public FileMetadata data(FileMetadataData data) { - + public FileMetadata data(@javax.annotation.Nonnull FileMetadataData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public FileMetadataData getData() { return data; } - - public void setData(FileMetadataData data) { + public void setData(@javax.annotation.Nonnull FileMetadataData data) { this.data = data; } - public FileMetadata links(Map links) { - + public FileMetadata links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public FileMetadata putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileMetadata is not found in the empty JSON string", FileMetadata.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileMetadata.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileMetadata` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileMetadata.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + FileMetadataData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileMetadata + * @throws IOException if the JSON string is invalid with respect to FileMetadata + */ + public static FileMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileMetadata.class); + } + + /** + * Convert an instance of FileMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileMetadataData.java b/src/main/java/com/vertexvis/model/FileMetadataData.java index 23cc138..14ad84c 100644 --- a/src/main/java/com/vertexvis/model/FileMetadataData.java +++ b/src/main/java/com/vertexvis/model/FileMetadataData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.FileMetadataDataAttributes; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * FileMetadataData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileMetadataData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private FileMetadataDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public FileMetadataData() { + public FileMetadataData() { } - public FileMetadataData type(String type) { - + public FileMetadataData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "file", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public FileMetadataData id(UUID id) { - + public FileMetadataData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public FileMetadataData attributes(FileMetadataDataAttributes attributes) { - + public FileMetadataData attributes(@javax.annotation.Nonnull FileMetadataDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public FileMetadataDataAttributes getAttributes() { return attributes; } - - public void setAttributes(FileMetadataDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull FileMetadataDataAttributes attributes) { this.attributes = attributes; } - public FileMetadataData links(Map links) { - + public FileMetadataData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public FileMetadataData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileMetadataData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileMetadataData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileMetadataData is not found in the empty JSON string", FileMetadataData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileMetadataData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileMetadataData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileMetadataData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + FileMetadataDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileMetadataData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileMetadataData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileMetadataData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileMetadataData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileMetadataData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileMetadataData given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileMetadataData + * @throws IOException if the JSON string is invalid with respect to FileMetadataData + */ + public static FileMetadataData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileMetadataData.class); + } + + /** + * Convert an instance of FileMetadataData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileMetadataDataAttributes.java b/src/main/java/com/vertexvis/model/FileMetadataDataAttributes.java index 0148a4b..ee95e4f 100644 --- a/src/main/java/com/vertexvis/model/FileMetadataDataAttributes.java +++ b/src/main/java/com/vertexvis/model/FileMetadataDataAttributes.java @@ -14,214 +14,215 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * FileMetadataDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileMetadataDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_ROOT_FILE_NAME = "rootFileName"; @SerializedName(SERIALIZED_NAME_ROOT_FILE_NAME) + @javax.annotation.Nullable private String rootFileName; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_UPLOADED = "uploaded"; @SerializedName(SERIALIZED_NAME_UPLOADED) + @javax.annotation.Nullable private OffsetDateTime uploaded; public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; - public FileMetadataDataAttributes() { + public FileMetadataDataAttributes() { } - public FileMetadataDataAttributes name(String name) { - + public FileMetadataDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public FileMetadataDataAttributes status(String status) { - + public FileMetadataDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "complete", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } - public FileMetadataDataAttributes suppliedId(String suppliedId) { - + public FileMetadataDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public FileMetadataDataAttributes rootFileName(String rootFileName) { - + public FileMetadataDataAttributes rootFileName(@javax.annotation.Nullable String rootFileName) { this.rootFileName = rootFileName; return this; } - /** + /** * Get rootFileName * @return rootFileName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getRootFileName() { return rootFileName; } - - public void setRootFileName(String rootFileName) { + public void setRootFileName(@javax.annotation.Nullable String rootFileName) { this.rootFileName = rootFileName; } - public FileMetadataDataAttributes created(OffsetDateTime created) { - + public FileMetadataDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public FileMetadataDataAttributes uploaded(OffsetDateTime uploaded) { - + public FileMetadataDataAttributes uploaded(@javax.annotation.Nullable OffsetDateTime uploaded) { this.uploaded = uploaded; return this; } - /** + /** * Get uploaded * @return uploaded - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getUploaded() { return uploaded; } - - public void setUploaded(OffsetDateTime uploaded) { + public void setUploaded(@javax.annotation.Nullable OffsetDateTime uploaded) { this.uploaded = uploaded; } - public FileMetadataDataAttributes size(Long size) { - + public FileMetadataDataAttributes size(@javax.annotation.Nullable Long size) { this.size = size; return this; } - /** + /** * Get size * @return size - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Long getSize() { return size; } - - public void setSize(Long size) { + public void setSize(@javax.annotation.Nullable Long size) { this.size = size; } + @Override public boolean equals(Object o) { if (this == o) { @@ -271,5 +272,117 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("status"); + openapiFields.add("suppliedId"); + openapiFields.add("rootFileName"); + openapiFields.add("created"); + openapiFields.add("uploaded"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileMetadataDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileMetadataDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileMetadataDataAttributes is not found in the empty JSON string", FileMetadataDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileMetadataDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileMetadataDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileMetadataDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("rootFileName") != null && !jsonObj.get("rootFileName").isJsonNull()) && !jsonObj.get("rootFileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rootFileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rootFileName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileMetadataDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileMetadataDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileMetadataDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileMetadataDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileMetadataDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileMetadataDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileMetadataDataAttributes + * @throws IOException if the JSON string is invalid with respect to FileMetadataDataAttributes + */ + public static FileMetadataDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileMetadataDataAttributes.class); + } + + /** + * Convert an instance of FileMetadataDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileRelationship.java b/src/main/java/com/vertexvis/model/FileRelationship.java index 57a3c9b..b600d5a 100644 --- a/src/main/java/com/vertexvis/model/FileRelationship.java +++ b/src/main/java/com/vertexvis/model/FileRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.FileRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `file`. */ -@ApiModel(description = "Relationship to a `file`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private FileRelationshipData data; - public FileRelationship() { + public FileRelationship() { } - public FileRelationship data(FileRelationshipData data) { - + public FileRelationship data(@javax.annotation.Nonnull FileRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public FileRelationshipData getData() { return data; } - - public void setData(FileRelationshipData data) { + public void setData(@javax.annotation.Nonnull FileRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileRelationship is not found in the empty JSON string", FileRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + FileRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileRelationship + * @throws IOException if the JSON string is invalid with respect to FileRelationship + */ + public static FileRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileRelationship.class); + } + + /** + * Convert an instance of FileRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FileRelationshipData.java b/src/main/java/com/vertexvis/model/FileRelationshipData.java index fb51088..c031e95 100644 --- a/src/main/java/com/vertexvis/model/FileRelationshipData.java +++ b/src/main/java/com/vertexvis/model/FileRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * FileRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class FileRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public FileRelationshipData() { + public FileRelationshipData() { } - public FileRelationshipData type(TypeEnum type) { - + public FileRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "file", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public FileRelationshipData id(UUID id) { - + public FileRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FileRelationshipData is not found in the empty JSON string", FileRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FileRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FileRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FileRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FileRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileRelationshipData + * @throws IOException if the JSON string is invalid with respect to FileRelationshipData + */ + public static FileRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileRelationshipData.class); + } + + /** + * Convert an instance of FileRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/FilterExpression.java b/src/main/java/com/vertexvis/model/FilterExpression.java new file mode 100644 index 0000000..1465f83 --- /dev/null +++ b/src/main/java/com/vertexvis/model/FilterExpression.java @@ -0,0 +1,356 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * Describes how an attribute should be filtered. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class FilterExpression { + public static final String SERIALIZED_NAME_EQ = "eq"; + @SerializedName(SERIALIZED_NAME_EQ) + @javax.annotation.Nullable + private String eq; + + public static final String SERIALIZED_NAME_NEQ = "neq"; + @SerializedName(SERIALIZED_NAME_NEQ) + @javax.annotation.Nullable + private String neq; + + public static final String SERIALIZED_NAME_GT = "gt"; + @SerializedName(SERIALIZED_NAME_GT) + @javax.annotation.Nullable + private String gt; + + public static final String SERIALIZED_NAME_GTE = "gte"; + @SerializedName(SERIALIZED_NAME_GTE) + @javax.annotation.Nullable + private String gte; + + public static final String SERIALIZED_NAME_LT = "lt"; + @SerializedName(SERIALIZED_NAME_LT) + @javax.annotation.Nullable + private String lt; + + public static final String SERIALIZED_NAME_LTE = "lte"; + @SerializedName(SERIALIZED_NAME_LTE) + @javax.annotation.Nullable + private String lte; + + public FilterExpression() { + } + + public FilterExpression eq(@javax.annotation.Nullable String eq) { + this.eq = eq; + return this; + } + + /** + * A value of a filter. + * @return eq + */ + @javax.annotation.Nullable + public String getEq() { + return eq; + } + + public void setEq(@javax.annotation.Nullable String eq) { + this.eq = eq; + } + + + public FilterExpression neq(@javax.annotation.Nullable String neq) { + this.neq = neq; + return this; + } + + /** + * A value of a filter. + * @return neq + */ + @javax.annotation.Nullable + public String getNeq() { + return neq; + } + + public void setNeq(@javax.annotation.Nullable String neq) { + this.neq = neq; + } + + + public FilterExpression gt(@javax.annotation.Nullable String gt) { + this.gt = gt; + return this; + } + + /** + * A value of a filter. + * @return gt + */ + @javax.annotation.Nullable + public String getGt() { + return gt; + } + + public void setGt(@javax.annotation.Nullable String gt) { + this.gt = gt; + } + + + public FilterExpression gte(@javax.annotation.Nullable String gte) { + this.gte = gte; + return this; + } + + /** + * A value of a filter. + * @return gte + */ + @javax.annotation.Nullable + public String getGte() { + return gte; + } + + public void setGte(@javax.annotation.Nullable String gte) { + this.gte = gte; + } + + + public FilterExpression lt(@javax.annotation.Nullable String lt) { + this.lt = lt; + return this; + } + + /** + * A value of a filter. + * @return lt + */ + @javax.annotation.Nullable + public String getLt() { + return lt; + } + + public void setLt(@javax.annotation.Nullable String lt) { + this.lt = lt; + } + + + public FilterExpression lte(@javax.annotation.Nullable String lte) { + this.lte = lte; + return this; + } + + /** + * A value of a filter. + * @return lte + */ + @javax.annotation.Nullable + public String getLte() { + return lte; + } + + public void setLte(@javax.annotation.Nullable String lte) { + this.lte = lte; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilterExpression filterExpression = (FilterExpression) o; + return Objects.equals(this.eq, filterExpression.eq) && + Objects.equals(this.neq, filterExpression.neq) && + Objects.equals(this.gt, filterExpression.gt) && + Objects.equals(this.gte, filterExpression.gte) && + Objects.equals(this.lt, filterExpression.lt) && + Objects.equals(this.lte, filterExpression.lte); + } + + @Override + public int hashCode() { + return Objects.hash(eq, neq, gt, gte, lt, lte); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilterExpression {\n"); + sb.append(" eq: ").append(toIndentedString(eq)).append("\n"); + sb.append(" neq: ").append(toIndentedString(neq)).append("\n"); + sb.append(" gt: ").append(toIndentedString(gt)).append("\n"); + sb.append(" gte: ").append(toIndentedString(gte)).append("\n"); + sb.append(" lt: ").append(toIndentedString(lt)).append("\n"); + sb.append(" lte: ").append(toIndentedString(lte)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eq"); + openapiFields.add("neq"); + openapiFields.add("gt"); + openapiFields.add("gte"); + openapiFields.add("lt"); + openapiFields.add("lte"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FilterExpression + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FilterExpression.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FilterExpression is not found in the empty JSON string", FilterExpression.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FilterExpression.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FilterExpression` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eq") != null && !jsonObj.get("eq").isJsonNull()) && !jsonObj.get("eq").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eq` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eq").toString())); + } + if ((jsonObj.get("neq") != null && !jsonObj.get("neq").isJsonNull()) && !jsonObj.get("neq").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `neq` to be a primitive type in the JSON string but got `%s`", jsonObj.get("neq").toString())); + } + if ((jsonObj.get("gt") != null && !jsonObj.get("gt").isJsonNull()) && !jsonObj.get("gt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `gt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gt").toString())); + } + if ((jsonObj.get("gte") != null && !jsonObj.get("gte").isJsonNull()) && !jsonObj.get("gte").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `gte` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gte").toString())); + } + if ((jsonObj.get("lt") != null && !jsonObj.get("lt").isJsonNull()) && !jsonObj.get("lt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lt").toString())); + } + if ((jsonObj.get("lte") != null && !jsonObj.get("lte").isJsonNull()) && !jsonObj.get("lte").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lte` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lte").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FilterExpression.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FilterExpression' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FilterExpression.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FilterExpression value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FilterExpression read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FilterExpression given an JSON string + * + * @param jsonString JSON string + * @return An instance of FilterExpression + * @throws IOException if the JSON string is invalid with respect to FilterExpression + */ + public static FilterExpression fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FilterExpression.class); + } + + /** + * Convert an instance of FilterExpression to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/GeometrySet.java b/src/main/java/com/vertexvis/model/GeometrySet.java index cb77692..f587f62 100644 --- a/src/main/java/com/vertexvis/model/GeometrySet.java +++ b/src/main/java/com/vertexvis/model/GeometrySet.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.GeometrySetData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * GeometrySet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class GeometrySet { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private GeometrySetData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public GeometrySet() { + public GeometrySet() { } - public GeometrySet data(GeometrySetData data) { - + public GeometrySet data(@javax.annotation.Nonnull GeometrySetData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public GeometrySetData getData() { return data; } - - public void setData(GeometrySetData data) { + public void setData(@javax.annotation.Nonnull GeometrySetData data) { this.data = data; } - public GeometrySet links(Map links) { - + public GeometrySet links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public GeometrySet putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeometrySet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeometrySet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeometrySet is not found in the empty JSON string", GeometrySet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeometrySet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeometrySet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeometrySet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + GeometrySetData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeometrySet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeometrySet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeometrySet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeometrySet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeometrySet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeometrySet given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeometrySet + * @throws IOException if the JSON string is invalid with respect to GeometrySet + */ + public static GeometrySet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeometrySet.class); + } + + /** + * Convert an instance of GeometrySet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/GeometrySetData.java b/src/main/java/com/vertexvis/model/GeometrySetData.java index e02c7dd..1c502fc 100644 --- a/src/main/java/com/vertexvis/model/GeometrySetData.java +++ b/src/main/java/com/vertexvis/model/GeometrySetData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.HitDataAttributes; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * GeometrySetData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class GeometrySetData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private HitDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public GeometrySetData() { + public GeometrySetData() { } - public GeometrySetData type(String type) { - + public GeometrySetData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "geometry-set", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public GeometrySetData id(UUID id) { - + public GeometrySetData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public GeometrySetData attributes(HitDataAttributes attributes) { - + public GeometrySetData attributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitDataAttributes getAttributes() { return attributes; } - - public void setAttributes(HitDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; } - public GeometrySetData links(Map links) { - + public GeometrySetData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public GeometrySetData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeometrySetData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeometrySetData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeometrySetData is not found in the empty JSON string", GeometrySetData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeometrySetData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeometrySetData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeometrySetData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + HitDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeometrySetData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeometrySetData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeometrySetData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeometrySetData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeometrySetData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeometrySetData + * @throws IOException if the JSON string is invalid with respect to GeometrySetData + */ + public static GeometrySetData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeometrySetData.class); + } + + /** + * Convert an instance of GeometrySetData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/GeometrySetList.java b/src/main/java/com/vertexvis/model/GeometrySetList.java index 6c4bf10..0167ade 100644 --- a/src/main/java/com/vertexvis/model/GeometrySetList.java +++ b/src/main/java/com/vertexvis/model/GeometrySetList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.GeometrySetData; import com.vertexvis.model.Link; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * GeometrySetList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class GeometrySetList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public GeometrySetList() { + public GeometrySetList() { } - public GeometrySetList data(List data) { - + public GeometrySetList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public GeometrySetList addDataItem(GeometrySetData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public GeometrySetList links(Map links) { - + public GeometrySetList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public GeometrySetList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeometrySetList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeometrySetList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeometrySetList is not found in the empty JSON string", GeometrySetList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeometrySetList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeometrySetList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeometrySetList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + GeometrySetData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeometrySetList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeometrySetList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeometrySetList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeometrySetList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeometrySetList given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeometrySetList + * @throws IOException if the JSON string is invalid with respect to GeometrySetList + */ + public static GeometrySetList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeometrySetList.class); + } + + /** + * Convert an instance of GeometrySetList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/GeometrySetRelationship.java b/src/main/java/com/vertexvis/model/GeometrySetRelationship.java index 58d5f18..208c88d 100644 --- a/src/main/java/com/vertexvis/model/GeometrySetRelationship.java +++ b/src/main/java/com/vertexvis/model/GeometrySetRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.GeometrySetRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `geometry-set`. */ -@ApiModel(description = "Relationship to a `geometry-set`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class GeometrySetRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private GeometrySetRelationshipData data; - public GeometrySetRelationship() { + public GeometrySetRelationship() { } - public GeometrySetRelationship data(GeometrySetRelationshipData data) { - + public GeometrySetRelationship data(@javax.annotation.Nonnull GeometrySetRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public GeometrySetRelationshipData getData() { return data; } - - public void setData(GeometrySetRelationshipData data) { + public void setData(@javax.annotation.Nonnull GeometrySetRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeometrySetRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeometrySetRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeometrySetRelationship is not found in the empty JSON string", GeometrySetRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeometrySetRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeometrySetRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeometrySetRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + GeometrySetRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeometrySetRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeometrySetRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeometrySetRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeometrySetRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeometrySetRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeometrySetRelationship + * @throws IOException if the JSON string is invalid with respect to GeometrySetRelationship + */ + public static GeometrySetRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeometrySetRelationship.class); + } + + /** + * Convert an instance of GeometrySetRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/GeometrySetRelationshipData.java b/src/main/java/com/vertexvis/model/GeometrySetRelationshipData.java index e16b45b..02ca44c 100644 --- a/src/main/java/com/vertexvis/model/GeometrySetRelationshipData.java +++ b/src/main/java/com/vertexvis/model/GeometrySetRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * GeometrySetRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class GeometrySetRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public GeometrySetRelationshipData() { + public GeometrySetRelationshipData() { } - public GeometrySetRelationshipData type(TypeEnum type) { - + public GeometrySetRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "geometry-set", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public GeometrySetRelationshipData id(UUID id) { - + public GeometrySetRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeometrySetRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeometrySetRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeometrySetRelationshipData is not found in the empty JSON string", GeometrySetRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeometrySetRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeometrySetRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeometrySetRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeometrySetRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeometrySetRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeometrySetRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeometrySetRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeometrySetRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeometrySetRelationshipData + * @throws IOException if the JSON string is invalid with respect to GeometrySetRelationshipData + */ + public static GeometrySetRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeometrySetRelationshipData.class); + } + + /** + * Convert an instance of GeometrySetRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Hit.java b/src/main/java/com/vertexvis/model/Hit.java index c744814..5629a1c 100644 --- a/src/main/java/com/vertexvis/model/Hit.java +++ b/src/main/java/com/vertexvis/model/Hit.java @@ -14,99 +14,114 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.HitData; -import com.vertexvis.model.HitResultData; +import com.vertexvis.model.HitIncludedInner; import com.vertexvis.model.Link; -import com.vertexvis.model.OneOfHitResultDataSceneItemDataPartRevisionData; -import com.vertexvis.model.PartRevisionData; -import com.vertexvis.model.SceneItemData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Hit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Hit { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private HitData data; public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) - private List included = new ArrayList<>(); + @javax.annotation.Nonnull + private List included = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Hit() { + public Hit() { } - public Hit data(HitData data) { - + public Hit data(@javax.annotation.Nonnull HitData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitData getData() { return data; } - - public void setData(HitData data) { + public void setData(@javax.annotation.Nonnull HitData data) { this.data = data; } - public Hit included(List included) { - + public Hit included(@javax.annotation.Nonnull List included) { this.included = included; return this; } - public Hit addIncludedItem(OneOfHitResultDataSceneItemDataPartRevisionData includedItem) { + public Hit addIncludedItem(HitIncludedInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } this.included.add(includedItem); return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public List getIncluded() { + public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nonnull List included) { this.included = included; } - public Hit links(Map links) { - + public Hit links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -119,23 +134,21 @@ public Hit putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -177,5 +190,112 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("included"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Hit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Hit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Hit is not found in the empty JSON string", Hit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Hit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Hit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Hit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + HitData.validateJsonElement(jsonObj.get("data")); + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + // validate the required field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + HitIncludedInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Hit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Hit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Hit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Hit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Hit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Hit given an JSON string + * + * @param jsonString JSON string + * @return An instance of Hit + * @throws IOException if the JSON string is invalid with respect to Hit + */ + public static Hit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Hit.class); + } + + /** + * Convert an instance of Hit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitData.java b/src/main/java/com/vertexvis/model/HitData.java index 28a389a..7cc7128 100644 --- a/src/main/java/com/vertexvis/model/HitData.java +++ b/src/main/java/com/vertexvis/model/HitData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,127 +21,138 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.HitDataAttributes; import com.vertexvis.model.HitDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * HitData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private HitDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private HitDataRelationships relationships; - public HitData() { + public HitData() { } - public HitData type(String type) { - + public HitData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "hit", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public HitData id(UUID id) { - + public HitData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public HitData attributes(HitDataAttributes attributes) { - + public HitData attributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitDataAttributes getAttributes() { return attributes; } - - public void setAttributes(HitDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; } - public HitData relationships(HitDataRelationships relationships) { - + public HitData relationships(@javax.annotation.Nonnull HitDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitDataRelationships getRelationships() { return relationships; } - - public void setRelationships(HitDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull HitDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -186,5 +196,113 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitData is not found in the empty JSON string", HitData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + HitDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + HitDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitData given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitData + * @throws IOException if the JSON string is invalid with respect to HitData + */ + public static HitData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitData.class); + } + + /** + * Convert an instance of HitData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitDataAttributes.java b/src/main/java/com/vertexvis/model/HitDataAttributes.java index 0117e41..f18bba4 100644 --- a/src/main/java/com/vertexvis/model/HitDataAttributes.java +++ b/src/main/java/com/vertexvis/model/HitDataAttributes.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * HitDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; - public HitDataAttributes() { + public HitDataAttributes() { } - public HitDataAttributes created(OffsetDateTime created) { - + public HitDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,97 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitDataAttributes is not found in the empty JSON string", HitDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitDataAttributes + * @throws IOException if the JSON string is invalid with respect to HitDataAttributes + */ + public static HitDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitDataAttributes.class); + } + + /** + * Convert an instance of HitDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitDataRelationships.java b/src/main/java/com/vertexvis/model/HitDataRelationships.java index 3ea3253..74f2211 100644 --- a/src/main/java/com/vertexvis/model/HitDataRelationships.java +++ b/src/main/java/com/vertexvis/model/HitDataRelationships.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * HitDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitDataRelationships { public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nonnull private List results = new ArrayList<>(); - public HitDataRelationships() { + public HitDataRelationships() { } - public HitDataRelationships results(List results) { - + public HitDataRelationships results(@javax.annotation.Nonnull List results) { this.results = results; return this; } public HitDataRelationships addResultsItem(RelationshipData resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } this.results.add(resultsItem); return this; } - /** + /** * Get results * @return results - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getResults() { return results; } - - public void setResults(List results) { + public void setResults(@javax.annotation.Nonnull List results) { this.results = results; } + @Override public boolean equals(Object o) { if (this == o) { @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("results"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("results"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitDataRelationships is not found in the empty JSON string", HitDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("results").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + + JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); + // validate the required field `results` (array) + for (int i = 0; i < jsonArrayresults.size(); i++) { + RelationshipData.validateJsonElement(jsonArrayresults.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitDataRelationships + * @throws IOException if the JSON string is invalid with respect to HitDataRelationships + */ + public static HitDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitDataRelationships.class); + } + + /** + * Convert an instance of HitDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitIncludedInner.java b/src/main/java/com/vertexvis/model/HitIncludedInner.java new file mode 100644 index 0000000..0cf579e --- /dev/null +++ b/src/main/java/com/vertexvis/model/HitIncludedInner.java @@ -0,0 +1,326 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.HitResultData; +import com.vertexvis.model.Link; +import com.vertexvis.model.PartRevisionData; +import com.vertexvis.model.PartRevisionDataAttributes; +import com.vertexvis.model.PartRevisionDataRelationships; +import com.vertexvis.model.SceneItemData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class HitIncludedInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(HitIncludedInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitIncludedInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitIncludedInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterHitResultData = gson.getDelegateAdapter(this, TypeToken.get(HitResultData.class)); + final TypeAdapter adapterSceneItemData = gson.getDelegateAdapter(this, TypeToken.get(SceneItemData.class)); + final TypeAdapter adapterPartRevisionData = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitIncludedInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `HitResultData` + if (value.getActualInstance() instanceof HitResultData) { + JsonElement element = adapterHitResultData.toJsonTree((HitResultData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneItemData` + if (value.getActualInstance() instanceof SceneItemData) { + JsonElement element = adapterSceneItemData.toJsonTree((SceneItemData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionData` + if (value.getActualInstance() instanceof PartRevisionData) { + JsonElement element = adapterPartRevisionData.toJsonTree((PartRevisionData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: HitResultData, PartRevisionData, SceneItemData"); + } + + @Override + public HitIncludedInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize HitResultData + try { + // validate the JSON object to see if any exception is thrown + HitResultData.validateJsonElement(jsonElement); + actualAdapter = adapterHitResultData; + match++; + log.log(Level.FINER, "Input data matches schema 'HitResultData'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for HitResultData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'HitResultData'", e); + } + // deserialize SceneItemData + try { + // validate the JSON object to see if any exception is thrown + SceneItemData.validateJsonElement(jsonElement); + actualAdapter = adapterSceneItemData; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneItemData'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneItemData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneItemData'", e); + } + // deserialize PartRevisionData + try { + // validate the JSON object to see if any exception is thrown + PartRevisionData.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionData; + match++; + log.log(Level.FINER, "Input data matches schema 'PartRevisionData'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionData'", e); + } + + if (match == 1) { + HitIncludedInner ret = new HitIncludedInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for HitIncludedInner: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public HitIncludedInner() { + super("oneOf", Boolean.FALSE); + } + + public HitIncludedInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("HitResultData", HitResultData.class); + schemas.put("SceneItemData", SceneItemData.class); + schemas.put("PartRevisionData", PartRevisionData.class); + } + + @Override + public Map> getSchemas() { + return HitIncludedInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * HitResultData, PartRevisionData, SceneItemData + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof HitResultData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneItemData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionData) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be HitResultData, PartRevisionData, SceneItemData"); + } + + /** + * Get the actual instance, which can be the following: + * HitResultData, PartRevisionData, SceneItemData + * + * @return The actual instance (HitResultData, PartRevisionData, SceneItemData) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `HitResultData`. If the actual instance is not `HitResultData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `HitResultData` + * @throws ClassCastException if the instance is not `HitResultData` + */ + public HitResultData getHitResultData() throws ClassCastException { + return (HitResultData)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneItemData`. If the actual instance is not `SceneItemData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneItemData` + * @throws ClassCastException if the instance is not `SceneItemData` + */ + public SceneItemData getSceneItemData() throws ClassCastException { + return (SceneItemData)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionData`. If the actual instance is not `PartRevisionData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionData` + * @throws ClassCastException if the instance is not `PartRevisionData` + */ + public PartRevisionData getPartRevisionData() throws ClassCastException { + return (PartRevisionData)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitIncludedInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with HitResultData + try { + HitResultData.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for HitResultData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneItemData + try { + SceneItemData.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneItemData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionData + try { + PartRevisionData.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionData failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for HitIncludedInner with oneOf schemas: HitResultData, PartRevisionData, SceneItemData. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of HitIncludedInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitIncludedInner + * @throws IOException if the JSON string is invalid with respect to HitIncludedInner + */ + public static HitIncludedInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitIncludedInner.class); + } + + /** + * Convert an instance of HitIncludedInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/HitResultData.java b/src/main/java/com/vertexvis/model/HitResultData.java index 7f7e686..67e57e3 100644 --- a/src/main/java/com/vertexvis/model/HitResultData.java +++ b/src/main/java/com/vertexvis/model/HitResultData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,127 +21,138 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.HitResultDataAttributes; import com.vertexvis.model.HitResultDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * HitResultData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitResultData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private HitResultDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private HitResultDataRelationships relationships; - public HitResultData() { + public HitResultData() { } - public HitResultData type(String type) { - + public HitResultData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "hit", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public HitResultData id(UUID id) { - + public HitResultData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public HitResultData attributes(HitResultDataAttributes attributes) { - + public HitResultData attributes(@javax.annotation.Nonnull HitResultDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitResultDataAttributes getAttributes() { return attributes; } - - public void setAttributes(HitResultDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull HitResultDataAttributes attributes) { this.attributes = attributes; } - public HitResultData relationships(HitResultDataRelationships relationships) { - + public HitResultData relationships(@javax.annotation.Nonnull HitResultDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitResultDataRelationships getRelationships() { return relationships; } - - public void setRelationships(HitResultDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull HitResultDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -186,5 +196,113 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitResultData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitResultData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitResultData is not found in the empty JSON string", HitResultData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitResultData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitResultData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitResultData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + HitResultDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + HitResultDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitResultData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitResultData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitResultData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitResultData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitResultData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitResultData given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitResultData + * @throws IOException if the JSON string is invalid with respect to HitResultData + */ + public static HitResultData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitResultData.class); + } + + /** + * Convert an instance of HitResultData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitResultDataAttributes.java b/src/main/java/com/vertexvis/model/HitResultDataAttributes.java index 5b2593c..42624cc 100644 --- a/src/main/java/com/vertexvis/model/HitResultDataAttributes.java +++ b/src/main/java/com/vertexvis/model/HitResultDataAttributes.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * HitResultDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitResultDataAttributes { public static final String SERIALIZED_NAME_POINT = "point"; @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nonnull private Vector3 point; public static final String SERIALIZED_NAME_NORMAL = "normal"; @SerializedName(SERIALIZED_NAME_NORMAL) + @javax.annotation.Nonnull private Vector3 normal; - public HitResultDataAttributes() { + public HitResultDataAttributes() { } - public HitResultDataAttributes point(Vector3 point) { - + public HitResultDataAttributes point(@javax.annotation.Nonnull Vector3 point) { this.point = point; return this; } - /** + /** * Get point * @return point - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getPoint() { return point; } - - public void setPoint(Vector3 point) { + public void setPoint(@javax.annotation.Nonnull Vector3 point) { this.point = point; } - public HitResultDataAttributes normal(Vector3 normal) { - + public HitResultDataAttributes normal(@javax.annotation.Nonnull Vector3 normal) { this.normal = normal; return this; } - /** + /** * Get normal * @return normal - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getNormal() { return normal; } - - public void setNormal(Vector3 normal) { + public void setNormal(@javax.annotation.Nonnull Vector3 normal) { this.normal = normal; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("point"); + openapiFields.add("normal"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("point"); + openapiRequiredFields.add("normal"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitResultDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitResultDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitResultDataAttributes is not found in the empty JSON string", HitResultDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitResultDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitResultDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitResultDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `point` + Vector3.validateJsonElement(jsonObj.get("point")); + // validate the required field `normal` + Vector3.validateJsonElement(jsonObj.get("normal")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitResultDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitResultDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitResultDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitResultDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitResultDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitResultDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitResultDataAttributes + * @throws IOException if the JSON string is invalid with respect to HitResultDataAttributes + */ + public static HitResultDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitResultDataAttributes.class); + } + + /** + * Convert an instance of HitResultDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/HitResultDataRelationships.java b/src/main/java/com/vertexvis/model/HitResultDataRelationships.java index 581b4f8..7c9b4a6 100644 --- a/src/main/java/com/vertexvis/model/HitResultDataRelationships.java +++ b/src/main/java/com/vertexvis/model/HitResultDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * HitResultDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class HitResultDataRelationships { public static final String SERIALIZED_NAME_SCENE_ITEM = "sceneItem"; @SerializedName(SERIALIZED_NAME_SCENE_ITEM) + @javax.annotation.Nonnull private RelationshipData sceneItem; - public HitResultDataRelationships() { + public HitResultDataRelationships() { } - public HitResultDataRelationships sceneItem(RelationshipData sceneItem) { - + public HitResultDataRelationships sceneItem(@javax.annotation.Nonnull RelationshipData sceneItem) { this.sceneItem = sceneItem; return this; } - /** + /** * Get sceneItem * @return sceneItem - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public RelationshipData getSceneItem() { return sceneItem; } - - public void setSceneItem(RelationshipData sceneItem) { + public void setSceneItem(@javax.annotation.Nonnull RelationshipData sceneItem) { this.sceneItem = sceneItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sceneItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sceneItem"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HitResultDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HitResultDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HitResultDataRelationships is not found in the empty JSON string", HitResultDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HitResultDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HitResultDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HitResultDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `sceneItem` + RelationshipData.validateJsonElement(jsonObj.get("sceneItem")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HitResultDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HitResultDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HitResultDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HitResultDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HitResultDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HitResultDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of HitResultDataRelationships + * @throws IOException if the JSON string is invalid with respect to HitResultDataRelationships + */ + public static HitResultDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HitResultDataRelationships.class); + } + + /** + * Convert an instance of HitResultDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Link.java b/src/main/java/com/vertexvis/model/Link.java index b4402a2..fad883b 100644 --- a/src/main/java/com/vertexvis/model/Link.java +++ b/src/main/java/com/vertexvis/model/Link.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Link */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Link { public static final String SERIALIZED_NAME_HREF = "href"; @SerializedName(SERIALIZED_NAME_HREF) + @javax.annotation.Nonnull private String href; - public Link() { + public Link() { } - public Link href(String href) { - + public Link href(@javax.annotation.Nonnull String href) { this.href = href; return this; } - /** + /** * Get href * @return href - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "/some-resource/d98d621a-23da-49fe-af96-6be709abb718", required = true, value = "") - public String getHref() { return href; } - - public void setHref(String href) { + public void setHref(@javax.annotation.Nonnull String href) { this.href = href; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("href"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("href"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Link + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Link.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Link is not found in the empty JSON string", Link.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Link.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Link` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Link.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("href").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Link.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Link' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Link.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Link value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Link read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Link given an JSON string + * + * @param jsonString JSON string + * @return An instance of Link + * @throws IOException if the JSON string is invalid with respect to Link + */ + public static Link fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Link.class); + } + + /** + * Convert an instance of Link to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MaterialOverride.java b/src/main/java/com/vertexvis/model/MaterialOverride.java index 126475d..98dd90f 100644 --- a/src/main/java/com/vertexvis/model/MaterialOverride.java +++ b/src/main/java/com/vertexvis/model/MaterialOverride.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterial; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Color material override. */ -@ApiModel(description = "Color material override.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MaterialOverride { public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable private ColorMaterial value; - public MaterialOverride() { + public MaterialOverride() { } - public MaterialOverride value(ColorMaterial value) { - + public MaterialOverride value(@javax.annotation.Nullable ColorMaterial value) { this.value = value; return this; } - /** + /** * Get value * @return value - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterial getValue() { return value; } - - public void setValue(ColorMaterial value) { + public void setValue(@javax.annotation.Nullable ColorMaterial value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,93 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MaterialOverride + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MaterialOverride.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MaterialOverride is not found in the empty JSON string", MaterialOverride.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MaterialOverride.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MaterialOverride` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + ColorMaterial.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MaterialOverride.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MaterialOverride' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MaterialOverride.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MaterialOverride value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MaterialOverride read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MaterialOverride given an JSON string + * + * @param jsonString JSON string + * @return An instance of MaterialOverride + * @throws IOException if the JSON string is invalid with respect to MaterialOverride + */ + public static MaterialOverride fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MaterialOverride.class); + } + + /** + * Convert an instance of MaterialOverride to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Matrix4.java b/src/main/java/com/vertexvis/model/Matrix4.java index b72ca87..690fb9a 100644 --- a/src/main/java/com/vertexvis/model/Matrix4.java +++ b/src/main/java/com/vertexvis/model/Matrix4.java @@ -14,134 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * 4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) for details. */ -@ApiModel(description = "4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) for details.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Matrix4 { public static final String SERIALIZED_NAME_R0 = "r0"; @SerializedName(SERIALIZED_NAME_R0) + @javax.annotation.Nonnull private Vector4 r0; public static final String SERIALIZED_NAME_R1 = "r1"; @SerializedName(SERIALIZED_NAME_R1) + @javax.annotation.Nonnull private Vector4 r1; public static final String SERIALIZED_NAME_R2 = "r2"; @SerializedName(SERIALIZED_NAME_R2) + @javax.annotation.Nonnull private Vector4 r2; public static final String SERIALIZED_NAME_R3 = "r3"; @SerializedName(SERIALIZED_NAME_R3) + @javax.annotation.Nonnull private Vector4 r3; - public Matrix4() { + public Matrix4() { } - public Matrix4 r0(Vector4 r0) { - + public Matrix4 r0(@javax.annotation.Nonnull Vector4 r0) { this.r0 = r0; return this; } - /** + /** * Get r0 * @return r0 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR0() { return r0; } - - public void setR0(Vector4 r0) { + public void setR0(@javax.annotation.Nonnull Vector4 r0) { this.r0 = r0; } - public Matrix4 r1(Vector4 r1) { - + public Matrix4 r1(@javax.annotation.Nonnull Vector4 r1) { this.r1 = r1; return this; } - /** + /** * Get r1 * @return r1 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR1() { return r1; } - - public void setR1(Vector4 r1) { + public void setR1(@javax.annotation.Nonnull Vector4 r1) { this.r1 = r1; } - public Matrix4 r2(Vector4 r2) { - + public Matrix4 r2(@javax.annotation.Nonnull Vector4 r2) { this.r2 = r2; return this; } - /** + /** * Get r2 * @return r2 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR2() { return r2; } - - public void setR2(Vector4 r2) { + public void setR2(@javax.annotation.Nonnull Vector4 r2) { this.r2 = r2; } - public Matrix4 r3(Vector4 r3) { - + public Matrix4 r3(@javax.annotation.Nonnull Vector4 r3) { this.r3 = r3; return this; } - /** + /** * Get r3 * @return r3 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR3() { return r3; } - - public void setR3(Vector4 r3) { + public void setR3(@javax.annotation.Nonnull Vector4 r3) { this.r3 = r3; } + @Override public boolean equals(Object o) { if (this == o) { @@ -185,5 +194,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("r0"); + openapiFields.add("r1"); + openapiFields.add("r2"); + openapiFields.add("r3"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("r0"); + openapiRequiredFields.add("r1"); + openapiRequiredFields.add("r2"); + openapiRequiredFields.add("r3"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Matrix4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Matrix4.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Matrix4 is not found in the empty JSON string", Matrix4.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Matrix4.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Matrix4` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Matrix4.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `r0` + Vector4.validateJsonElement(jsonObj.get("r0")); + // validate the required field `r1` + Vector4.validateJsonElement(jsonObj.get("r1")); + // validate the required field `r2` + Vector4.validateJsonElement(jsonObj.get("r2")); + // validate the required field `r3` + Vector4.validateJsonElement(jsonObj.get("r3")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Matrix4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Matrix4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Matrix4.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Matrix4 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Matrix4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Matrix4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Matrix4 + * @throws IOException if the JSON string is invalid with respect to Matrix4 + */ + public static Matrix4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Matrix4.class); + } + + /** + * Convert an instance of Matrix4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Matrix4Nullable.java b/src/main/java/com/vertexvis/model/Matrix4Nullable.java index 2361e8e..994857b 100644 --- a/src/main/java/com/vertexvis/model/Matrix4Nullable.java +++ b/src/main/java/com/vertexvis/model/Matrix4Nullable.java @@ -14,134 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * 4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) for details. */ -@ApiModel(description = "4x4 affine transformation matrix, see [Matrix transformations](https://developer.vertexvis.com/docs/guides/matrix-transformations) for details.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Matrix4Nullable { public static final String SERIALIZED_NAME_R0 = "r0"; @SerializedName(SERIALIZED_NAME_R0) + @javax.annotation.Nonnull private Vector4 r0; public static final String SERIALIZED_NAME_R1 = "r1"; @SerializedName(SERIALIZED_NAME_R1) + @javax.annotation.Nonnull private Vector4 r1; public static final String SERIALIZED_NAME_R2 = "r2"; @SerializedName(SERIALIZED_NAME_R2) + @javax.annotation.Nonnull private Vector4 r2; public static final String SERIALIZED_NAME_R3 = "r3"; @SerializedName(SERIALIZED_NAME_R3) + @javax.annotation.Nonnull private Vector4 r3; - public Matrix4Nullable() { + public Matrix4Nullable() { } - public Matrix4Nullable r0(Vector4 r0) { - + public Matrix4Nullable r0(@javax.annotation.Nonnull Vector4 r0) { this.r0 = r0; return this; } - /** + /** * Get r0 * @return r0 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR0() { return r0; } - - public void setR0(Vector4 r0) { + public void setR0(@javax.annotation.Nonnull Vector4 r0) { this.r0 = r0; } - public Matrix4Nullable r1(Vector4 r1) { - + public Matrix4Nullable r1(@javax.annotation.Nonnull Vector4 r1) { this.r1 = r1; return this; } - /** + /** * Get r1 * @return r1 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR1() { return r1; } - - public void setR1(Vector4 r1) { + public void setR1(@javax.annotation.Nonnull Vector4 r1) { this.r1 = r1; } - public Matrix4Nullable r2(Vector4 r2) { - + public Matrix4Nullable r2(@javax.annotation.Nonnull Vector4 r2) { this.r2 = r2; return this; } - /** + /** * Get r2 * @return r2 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR2() { return r2; } - - public void setR2(Vector4 r2) { + public void setR2(@javax.annotation.Nonnull Vector4 r2) { this.r2 = r2; } - public Matrix4Nullable r3(Vector4 r3) { - + public Matrix4Nullable r3(@javax.annotation.Nonnull Vector4 r3) { this.r3 = r3; return this; } - /** + /** * Get r3 * @return r3 - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector4 getR3() { return r3; } - - public void setR3(Vector4 r3) { + public void setR3(@javax.annotation.Nonnull Vector4 r3) { this.r3 = r3; } + @Override public boolean equals(Object o) { if (this == o) { @@ -185,5 +194,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("r0"); + openapiFields.add("r1"); + openapiFields.add("r2"); + openapiFields.add("r3"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("r0"); + openapiRequiredFields.add("r1"); + openapiRequiredFields.add("r2"); + openapiRequiredFields.add("r3"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Matrix4Nullable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Matrix4Nullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Matrix4Nullable is not found in the empty JSON string", Matrix4Nullable.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Matrix4Nullable.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Matrix4Nullable` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Matrix4Nullable.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `r0` + Vector4.validateJsonElement(jsonObj.get("r0")); + // validate the required field `r1` + Vector4.validateJsonElement(jsonObj.get("r1")); + // validate the required field `r2` + Vector4.validateJsonElement(jsonObj.get("r2")); + // validate the required field `r3` + Vector4.validateJsonElement(jsonObj.get("r3")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Matrix4Nullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Matrix4Nullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Matrix4Nullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Matrix4Nullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Matrix4Nullable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Matrix4Nullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of Matrix4Nullable + * @throws IOException if the JSON string is invalid with respect to Matrix4Nullable + */ + public static Matrix4Nullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Matrix4Nullable.class); + } + + /** + * Convert an instance of Matrix4Nullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MetadataDateType.java b/src/main/java/com/vertexvis/model/MetadataDateType.java index 159bf52..0012f67 100644 --- a/src/main/java/com/vertexvis/model/MetadataDateType.java +++ b/src/main/java/com/vertexvis/model/MetadataDateType.java @@ -10,83 +10,100 @@ * Do not edit the class manually. */ +// DO NOT OVERWRITE: Customized JSON class package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * MetadataDateType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MetadataDateType { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull private OffsetDateTime value; - public MetadataDateType() { + public MetadataDateType() { } - public MetadataDateType type(String type) { - + public MetadataDateType type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Type of metadata value. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "date", required = true, value = "Type of metadata value.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public MetadataDateType value(OffsetDateTime value) { - + public MetadataDateType value(@javax.annotation.Nonnull OffsetDateTime value) { this.value = value; return this; } - /** + /** * A date value. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2022-02-22T10:11:12Z", required = true, value = "A date value.") - public OffsetDateTime getValue() { return value; } - - public void setValue(OffsetDateTime value) { + public void setValue(@javax.annotation.Nonnull OffsetDateTime value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +143,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MetadataDateType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MetadataDateType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MetadataDateType is not found in the empty JSON string", MetadataDateType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MetadataDateType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MetadataDateType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MetadataDateType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").getAsString().equals("date")) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a `date` primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MetadataDateType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MetadataDateType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MetadataDateType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MetadataDateType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MetadataDateType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MetadataDateType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MetadataDateType + * @throws IOException if the JSON string is invalid with respect to MetadataDateType + */ + public static MetadataDateType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MetadataDateType.class); + } + + /** + * Convert an instance of MetadataDateType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MetadataFloatType.java b/src/main/java/com/vertexvis/model/MetadataFloatType.java index 79d3028..abe7782 100644 --- a/src/main/java/com/vertexvis/model/MetadataFloatType.java +++ b/src/main/java/com/vertexvis/model/MetadataFloatType.java @@ -10,82 +10,99 @@ * Do not edit the class manually. */ +// DO NOT OVERWRITE: Customized JSON class package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * MetadataFloatType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MetadataFloatType { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull private Float value; - public MetadataFloatType() { + public MetadataFloatType() { } - public MetadataFloatType type(String type) { - + public MetadataFloatType type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Type of metadata value. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "float", required = true, value = "Type of metadata value.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public MetadataFloatType value(Float value) { - + public MetadataFloatType value(@javax.annotation.Nonnull Float value) { this.value = value; return this; } - /** + /** * A numerical floating-point value. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A numerical floating-point value.") - public Float getValue() { return value; } - - public void setValue(Float value) { + public void setValue(@javax.annotation.Nonnull Float value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,5 +142,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MetadataFloatType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MetadataFloatType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MetadataFloatType is not found in the empty JSON string", MetadataFloatType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MetadataFloatType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MetadataFloatType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MetadataFloatType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").getAsString().equals("float")) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a `float` primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MetadataFloatType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MetadataFloatType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MetadataFloatType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MetadataFloatType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MetadataFloatType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MetadataFloatType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MetadataFloatType + * @throws IOException if the JSON string is invalid with respect to MetadataFloatType + */ + public static MetadataFloatType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MetadataFloatType.class); + } + + /** + * Convert an instance of MetadataFloatType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MetadataLongType.java b/src/main/java/com/vertexvis/model/MetadataLongType.java index 218abba..b93bbf7 100644 --- a/src/main/java/com/vertexvis/model/MetadataLongType.java +++ b/src/main/java/com/vertexvis/model/MetadataLongType.java @@ -10,82 +10,99 @@ * Do not edit the class manually. */ +// DO NOT OVERWRITE: Customized JSON class package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * MetadataLongType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MetadataLongType { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull private Long value; - public MetadataLongType() { + public MetadataLongType() { } - public MetadataLongType type(String type) { - + public MetadataLongType type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Type of metadata value. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "long", required = true, value = "Type of metadata value.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public MetadataLongType value(Long value) { - + public MetadataLongType value(@javax.annotation.Nonnull Long value) { this.value = value; return this; } - /** + /** * A numerical long value. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A numerical long value.") - public Long getValue() { return value; } - - public void setValue(Long value) { + public void setValue(@javax.annotation.Nonnull Long value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,5 +142,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MetadataLongType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MetadataLongType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MetadataLongType is not found in the empty JSON string", MetadataLongType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MetadataLongType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MetadataLongType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MetadataLongType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").getAsString().equals("long")) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a `long` primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("value").getAsDouble() != (double)jsonObj.get("value").getAsLong()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type of `long` but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MetadataLongType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MetadataLongType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MetadataLongType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MetadataLongType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MetadataLongType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MetadataLongType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MetadataLongType + * @throws IOException if the JSON string is invalid with respect to MetadataLongType + */ + public static MetadataLongType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MetadataLongType.class); + } + + /** + * Convert an instance of MetadataLongType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MetadataNullType.java b/src/main/java/com/vertexvis/model/MetadataNullType.java index 0b38b1c..e1459e8 100644 --- a/src/main/java/com/vertexvis/model/MetadataNullType.java +++ b/src/main/java/com/vertexvis/model/MetadataNullType.java @@ -10,55 +10,75 @@ * Do not edit the class manually. */ +// DO NOT OVERWRITE: Customized JSON class package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * MetadataNullType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MetadataNullType { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; - public MetadataNullType() { + public MetadataNullType() { } - public MetadataNullType type(String type) { - + public MetadataNullType type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Type of metadata value. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "null", required = true, value = "Type of metadata value.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +116,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MetadataNullType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MetadataNullType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MetadataNullType is not found in the empty JSON string", MetadataNullType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MetadataNullType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MetadataNullType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MetadataNullType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").getAsString().equals("null")) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a `null` primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MetadataNullType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MetadataNullType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MetadataNullType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MetadataNullType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MetadataNullType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MetadataNullType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MetadataNullType + * @throws IOException if the JSON string is invalid with respect to MetadataNullType + */ + public static MetadataNullType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MetadataNullType.class); + } + + /** + * Convert an instance of MetadataNullType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/MetadataStringType.java b/src/main/java/com/vertexvis/model/MetadataStringType.java index 8a41140..87ff549 100644 --- a/src/main/java/com/vertexvis/model/MetadataStringType.java +++ b/src/main/java/com/vertexvis/model/MetadataStringType.java @@ -10,82 +10,99 @@ * Do not edit the class manually. */ +// DO NOT OVERWRITE: Customized JSON class package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * MetadataStringType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class MetadataStringType { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull private String value; - public MetadataStringType() { + public MetadataStringType() { } - public MetadataStringType type(String type) { - + public MetadataStringType type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Type of metadata value. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "string", required = true, value = "Type of metadata value.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public MetadataStringType value(String value) { - + public MetadataStringType value(@javax.annotation.Nonnull String value) { this.value = value; return this; } - /** + /** * A string value. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "Some value", required = true, value = "A string value.") - public String getValue() { return value; } - - public void setValue(String value) { + public void setValue(@javax.annotation.Nonnull String value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -125,5 +142,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MetadataStringType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MetadataStringType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MetadataStringType is not found in the empty JSON string", MetadataStringType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MetadataStringType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MetadataStringType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MetadataStringType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").getAsString().equals("string")) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a `string` primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MetadataStringType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MetadataStringType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MetadataStringType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MetadataStringType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MetadataStringType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MetadataStringType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MetadataStringType + * @throws IOException if the JSON string is invalid with respect to MetadataStringType + */ + public static MetadataStringType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MetadataStringType.class); + } + + /** + * Convert an instance of MetadataStringType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ModelView.java b/src/main/java/com/vertexvis/model/ModelView.java new file mode 100644 index 0000000..d553f6d --- /dev/null +++ b/src/main/java/com/vertexvis/model/ModelView.java @@ -0,0 +1,252 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.ModelViewData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * ModelView + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class ModelView { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private ModelViewData data; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public ModelView() { + } + + public ModelView data(@javax.annotation.Nonnull ModelViewData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public ModelViewData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull ModelViewData data) { + this.data = data; + } + + + public ModelView links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public ModelView putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelView modelView = (ModelView) o; + return Objects.equals(this.data, modelView.data) && + Objects.equals(this.links, modelView.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelView {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelView + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelView.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelView is not found in the empty JSON string", ModelView.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModelView.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelView` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModelView.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ModelViewData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelView.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelView' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelView.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelView value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModelView read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelView given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelView + * @throws IOException if the JSON string is invalid with respect to ModelView + */ + public static ModelView fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelView.class); + } + + /** + * Convert an instance of ModelView to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/ModelViewData.java b/src/main/java/com/vertexvis/model/ModelViewData.java new file mode 100644 index 0000000..00dd67a --- /dev/null +++ b/src/main/java/com/vertexvis/model/ModelViewData.java @@ -0,0 +1,346 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateAccountRequestDataAttributes; +import com.vertexvis.model.Link; +import com.vertexvis.model.ModelViewDataRelationships; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * ModelViewData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class ModelViewData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private CreateAccountRequestDataAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull + private ModelViewDataRelationships relationships; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public ModelViewData() { + } + + public ModelViewData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public ModelViewData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public ModelViewData attributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public CreateAccountRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + public ModelViewData relationships(@javax.annotation.Nonnull ModelViewDataRelationships relationships) { + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + */ + @javax.annotation.Nonnull + public ModelViewDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(@javax.annotation.Nonnull ModelViewDataRelationships relationships) { + this.relationships = relationships; + } + + + public ModelViewData links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public ModelViewData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelViewData modelViewData = (ModelViewData) o; + return Objects.equals(this.type, modelViewData.type) && + Objects.equals(this.id, modelViewData.id) && + Objects.equals(this.attributes, modelViewData.attributes) && + Objects.equals(this.relationships, modelViewData.relationships) && + Objects.equals(this.links, modelViewData.links); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelViewData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelViewData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelViewData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelViewData is not found in the empty JSON string", ModelViewData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModelViewData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelViewData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModelViewData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + CreateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + ModelViewDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelViewData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelViewData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelViewData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelViewData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModelViewData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelViewData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelViewData + * @throws IOException if the JSON string is invalid with respect to ModelViewData + */ + public static ModelViewData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelViewData.class); + } + + /** + * Convert an instance of ModelViewData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/ModelViewDataRelationships.java b/src/main/java/com/vertexvis/model/ModelViewDataRelationships.java new file mode 100644 index 0000000..f7f8fb1 --- /dev/null +++ b/src/main/java/com/vertexvis/model/ModelViewDataRelationships.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PartRevisionRelationship; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * ModelViewDataRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class ModelViewDataRelationships { + public static final String SERIALIZED_NAME_PART_REVISION = "partRevision"; + @SerializedName(SERIALIZED_NAME_PART_REVISION) + @javax.annotation.Nonnull + private PartRevisionRelationship partRevision; + + public ModelViewDataRelationships() { + } + + public ModelViewDataRelationships partRevision(@javax.annotation.Nonnull PartRevisionRelationship partRevision) { + this.partRevision = partRevision; + return this; + } + + /** + * Get partRevision + * @return partRevision + */ + @javax.annotation.Nonnull + public PartRevisionRelationship getPartRevision() { + return partRevision; + } + + public void setPartRevision(@javax.annotation.Nonnull PartRevisionRelationship partRevision) { + this.partRevision = partRevision; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelViewDataRelationships modelViewDataRelationships = (ModelViewDataRelationships) o; + return Objects.equals(this.partRevision, modelViewDataRelationships.partRevision); + } + + @Override + public int hashCode() { + return Objects.hash(partRevision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelViewDataRelationships {\n"); + sb.append(" partRevision: ").append(toIndentedString(partRevision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("partRevision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("partRevision"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelViewDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelViewDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelViewDataRelationships is not found in the empty JSON string", ModelViewDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModelViewDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelViewDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModelViewDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `partRevision` + PartRevisionRelationship.validateJsonElement(jsonObj.get("partRevision")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelViewDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelViewDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelViewDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelViewDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModelViewDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelViewDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelViewDataRelationships + * @throws IOException if the JSON string is invalid with respect to ModelViewDataRelationships + */ + public static ModelViewDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelViewDataRelationships.class); + } + + /** + * Convert an instance of ModelViewDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/ModelViewList.java b/src/main/java/com/vertexvis/model/ModelViewList.java new file mode 100644 index 0000000..7d87df0 --- /dev/null +++ b/src/main/java/com/vertexvis/model/ModelViewList.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.ModelViewData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * ModelViewList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class ModelViewList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private Map links = new HashMap<>(); + + public ModelViewList() { + } + + public ModelViewList data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public ModelViewList addDataItem(ModelViewData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public ModelViewList links(@javax.annotation.Nonnull Map links) { + this.links = links; + return this; + } + + public ModelViewList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelViewList modelViewList = (ModelViewList) o; + return Objects.equals(this.data, modelViewList.data) && + Objects.equals(this.links, modelViewList.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelViewList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelViewList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelViewList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelViewList is not found in the empty JSON string", ModelViewList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModelViewList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelViewList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModelViewList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ModelViewData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelViewList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelViewList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelViewList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelViewList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModelViewList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelViewList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelViewList + * @throws IOException if the JSON string is invalid with respect to ModelViewList + */ + public static ModelViewList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelViewList.class); + } + + /** + * Convert an instance of ModelViewList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/OAuth2BadRequest.java b/src/main/java/com/vertexvis/model/OAuth2BadRequest.java index b609f95..89b17f8 100644 --- a/src/main/java/com/vertexvis/model/OAuth2BadRequest.java +++ b/src/main/java/com/vertexvis/model/OAuth2BadRequest.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * OAuth2BadRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class OAuth2BadRequest { public static final String SERIALIZED_NAME_ERROR = "error"; @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nonnull private String error; - public OAuth2BadRequest() { + public OAuth2BadRequest() { } - public OAuth2BadRequest error(String error) { - + public OAuth2BadRequest error(@javax.annotation.Nonnull String error) { this.error = error; return this; } - /** + /** * Get error * @return error - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getError() { return error; } - - public void setError(String error) { + public void setError(@javax.annotation.Nonnull String error) { this.error = error; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("error"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("error"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OAuth2BadRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OAuth2BadRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OAuth2BadRequest is not found in the empty JSON string", OAuth2BadRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OAuth2BadRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OAuth2BadRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OAuth2BadRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OAuth2BadRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OAuth2BadRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OAuth2BadRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OAuth2BadRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OAuth2BadRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OAuth2BadRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OAuth2BadRequest + * @throws IOException if the JSON string is invalid with respect to OAuth2BadRequest + */ + public static OAuth2BadRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OAuth2BadRequest.class); + } + + /** + * Convert an instance of OAuth2BadRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/OAuth2Token.java b/src/main/java/com/vertexvis/model/OAuth2Token.java index bda40b8..73bb0cc 100644 --- a/src/main/java/com/vertexvis/model/OAuth2Token.java +++ b/src/main/java/com/vertexvis/model/OAuth2Token.java @@ -14,193 +14,200 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * OAuth2Token */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class OAuth2Token { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) + @javax.annotation.Nonnull private String accessToken; public static final String SERIALIZED_NAME_TOKEN_TYPE = "token_type"; @SerializedName(SERIALIZED_NAME_TOKEN_TYPE) + @javax.annotation.Nonnull private String tokenType; public static final String SERIALIZED_NAME_ACCOUNT_ID = "account_id"; @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + @javax.annotation.Nonnull private String accountId; public static final String SERIALIZED_NAME_EXPIRES_IN = "expires_in"; @SerializedName(SERIALIZED_NAME_EXPIRES_IN) + @javax.annotation.Nonnull private Integer expiresIn; public static final String SERIALIZED_NAME_SCOPES = "scopes"; @SerializedName(SERIALIZED_NAME_SCOPES) + @javax.annotation.Nonnull private List scopes = new ArrayList<>(); public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token"; @SerializedName(SERIALIZED_NAME_REFRESH_TOKEN) + @javax.annotation.Nullable private String refreshToken; - public OAuth2Token() { + public OAuth2Token() { } - public OAuth2Token accessToken(String accessToken) { - + public OAuth2Token accessToken(@javax.annotation.Nonnull String accessToken) { this.accessToken = accessToken; return this; } - /** + /** * Get accessToken * @return accessToken - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "HnkQzHpk4iTaPfssu3zpI.PTbAxKdDIfrNcgrmsxQqg", required = true, value = "") - public String getAccessToken() { return accessToken; } - - public void setAccessToken(String accessToken) { + public void setAccessToken(@javax.annotation.Nonnull String accessToken) { this.accessToken = accessToken; } - public OAuth2Token tokenType(String tokenType) { - + public OAuth2Token tokenType(@javax.annotation.Nonnull String tokenType) { this.tokenType = tokenType; return this; } - /** + /** * Get tokenType * @return tokenType - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "bearer", required = true, value = "") - public String getTokenType() { return tokenType; } - - public void setTokenType(String tokenType) { + public void setTokenType(@javax.annotation.Nonnull String tokenType) { this.tokenType = tokenType; } - public OAuth2Token accountId(String accountId) { - + public OAuth2Token accountId(@javax.annotation.Nonnull String accountId) { this.accountId = accountId; return this; } - /** + /** * Get accountId * @return accountId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "7b3f55e2-60f3-4bf3-82bc-f8afbce843b0", required = true, value = "") - public String getAccountId() { return accountId; } - - public void setAccountId(String accountId) { + public void setAccountId(@javax.annotation.Nonnull String accountId) { this.accountId = accountId; } - public OAuth2Token expiresIn(Integer expiresIn) { - + public OAuth2Token expiresIn(@javax.annotation.Nonnull Integer expiresIn) { this.expiresIn = expiresIn; return this; } - /** + /** * Get expiresIn * @return expiresIn - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "3600", required = true, value = "") - public Integer getExpiresIn() { return expiresIn; } - - public void setExpiresIn(Integer expiresIn) { + public void setExpiresIn(@javax.annotation.Nonnull Integer expiresIn) { this.expiresIn = expiresIn; } - public OAuth2Token scopes(List scopes) { - + public OAuth2Token scopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; return this; } public OAuth2Token addScopesItem(String scopesItem) { + if (this.scopes == null) { + this.scopes = new ArrayList<>(); + } this.scopes.add(scopesItem); return this; } - /** + /** * Get scopes * @return scopes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getScopes() { return scopes; } - - public void setScopes(List scopes) { + public void setScopes(@javax.annotation.Nonnull List scopes) { this.scopes = scopes; } - public OAuth2Token refreshToken(String refreshToken) { - + public OAuth2Token refreshToken(@javax.annotation.Nullable String refreshToken) { this.refreshToken = refreshToken; return this; } - /** + /** * Get refreshToken * @return refreshToken - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "HnkQzHpk4iTaPfssu3zpI.PTbAxKdDIfrNcgrmsxQqg", value = "") - public String getRefreshToken() { return refreshToken; } - - public void setRefreshToken(String refreshToken) { + public void setRefreshToken(@javax.annotation.Nullable String refreshToken) { this.refreshToken = refreshToken; } + @Override public boolean equals(Object o) { if (this == o) { @@ -248,5 +255,124 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("access_token"); + openapiFields.add("token_type"); + openapiFields.add("account_id"); + openapiFields.add("expires_in"); + openapiFields.add("scopes"); + openapiFields.add("refresh_token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("access_token"); + openapiRequiredFields.add("token_type"); + openapiRequiredFields.add("account_id"); + openapiRequiredFields.add("expires_in"); + openapiRequiredFields.add("scopes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OAuth2Token + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OAuth2Token.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OAuth2Token is not found in the empty JSON string", OAuth2Token.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OAuth2Token.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OAuth2Token` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OAuth2Token.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("access_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `access_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("access_token").toString())); + } + if (!jsonObj.get("token_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token_type").toString())); + } + if (!jsonObj.get("account_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `account_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account_id").toString())); + } + // ensure the required json array is present + if (jsonObj.get("scopes") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("scopes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scopes` to be an array in the JSON string but got `%s`", jsonObj.get("scopes").toString())); + } + if ((jsonObj.get("refresh_token") != null && !jsonObj.get("refresh_token").isJsonNull()) && !jsonObj.get("refresh_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `refresh_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refresh_token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OAuth2Token.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OAuth2Token' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OAuth2Token.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OAuth2Token value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OAuth2Token read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OAuth2Token given an JSON string + * + * @param jsonString JSON string + * @return An instance of OAuth2Token + * @throws IOException if the JSON string is invalid with respect to OAuth2Token + */ + public static OAuth2Token fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OAuth2Token.class); + } + + /** + * Convert an instance of OAuth2Token to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/OneOfCADExportConfig.java b/src/main/java/com/vertexvis/model/OneOfCADExportConfig.java deleted file mode 100644 index 3610b73..0000000 --- a/src/main/java/com/vertexvis/model/OneOfCADExportConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.vertexvis.model; - -import java.util.Optional; - -/** - * Manually created class - */ -public class OneOfCADExportConfig { - private final CADExportConfig cadExportConfig; - - public OneOfCADExportConfig(CADExportConfig cadExportConfig) { - this.cadExportConfig = cadExportConfig; - } - - public boolean hasCADExportConfig() { - return cadExportConfig != null; - } - - public Optional getCADExportConfig() { - return Optional.ofNullable(cadExportConfig); - } -} diff --git a/src/main/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionData.java b/src/main/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionData.java deleted file mode 100644 index db2f9aa..0000000 --- a/src/main/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionData.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class OneOfHitResultDataSceneItemDataPartRevisionData { - private HitResultData hitResultData; - private SceneItemData sceneItemData; - private PartRevisionData partRevisionData; - - public OneOfHitResultDataSceneItemDataPartRevisionData(HitResultData hitResultData) { - this.hitResultData = hitResultData; - } - - public OneOfHitResultDataSceneItemDataPartRevisionData(SceneItemData sceneItemData) { - this.sceneItemData = sceneItemData; - } - - public OneOfHitResultDataSceneItemDataPartRevisionData(PartRevisionData partRevisionData) { - this.partRevisionData = partRevisionData; - } - - public Object getData() { - if (this.hitResultData != null) { - return this.hitResultData; - } - if (this.partRevisionData != null) { - return this.partRevisionData; - } - if (this.sceneItemData != null) { - return this.sceneItemData; - } - - return null; - } - - @Nullable - public HitResultData getHitResultData() { - return this.hitResultData; - } - - @Nullable - public SceneItemData getSceneItemData() { - return this.sceneItemData; - } - - @Nullable - public PartRevisionData getPartRevisionData() { - return this.partRevisionData; - } -} diff --git a/src/main/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCamera.java b/src/main/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCamera.java deleted file mode 100644 index 5fc5780..0000000 --- a/src/main/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCamera.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class OneOfPerspectiveCameraOrthographicCamera { - private PerspectiveCamera perspectiveCamera; - private OrthographicCamera orthographicCamera; - - public OneOfPerspectiveCameraOrthographicCamera(PerspectiveCamera perspectiveCamera) { - this.perspectiveCamera = perspectiveCamera; - } - - public OneOfPerspectiveCameraOrthographicCamera(OrthographicCamera orthographicCamera) { - this.orthographicCamera = orthographicCamera; - } - - public Object getData() { - if (this.perspectiveCamera != null) { - return this.perspectiveCamera; - } - if (this.orthographicCamera != null) { - return this.orthographicCamera; - } - - return null; - } - - @Nullable - public OrthographicCamera getOrthographicCamera() { - return this.orthographicCamera; - } - - @Nullable - public PerspectiveCamera getPerspectiveCamera() { - return this.perspectiveCamera; - } -} - diff --git a/src/main/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationship.java b/src/main/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationship.java deleted file mode 100644 index a2f880c..0000000 --- a/src/main/java/com/vertexvis/model/OneOfSceneViewRelationshipSceneViewStateRelationship.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class OneOfSceneViewRelationshipSceneViewStateRelationship { - private SceneViewRelationship svRel; - private SceneViewStateRelationship svsRel; - - public OneOfSceneViewRelationshipSceneViewStateRelationship(SceneViewRelationship svRel) { - this.svRel = svRel; - } - - public OneOfSceneViewRelationshipSceneViewStateRelationship(SceneViewStateRelationship svsRel) { - this.svsRel = svsRel; - } - - public Object getRel() { - if (this.svRel != null) { - return this.svRel; - } - if (this.svsRel != null) { - return this.svsRel; - } - - return null; - } - - public boolean isSceneViewRel() { - return this.svRel != null; - } - - public boolean isSceneViewStateRel() { - return this.svsRel != null; - } - - @Nullable - public SceneViewRelationship getSceneViewRel() { - return this.svRel; - } - - @Nullable - public SceneViewStateRelationship getSceneViewStateRel() { - return this.svsRel; - } -} diff --git a/src/main/java/com/vertexvis/model/OneOfUpdateItemToDefaultRenditionOperation.java b/src/main/java/com/vertexvis/model/OneOfUpdateItemToDefaultRenditionOperation.java deleted file mode 100644 index 3ab8c2a..0000000 --- a/src/main/java/com/vertexvis/model/OneOfUpdateItemToDefaultRenditionOperation.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class OneOfUpdateItemToDefaultRenditionOperation { - private UpdateItemToDefaultRenditionOperation updateItemToDefaultRenditionOperation; - - public OneOfUpdateItemToDefaultRenditionOperation(UpdateItemToDefaultRenditionOperation updateItemToDefaultRenditionOperation) { - this.updateItemToDefaultRenditionOperation = updateItemToDefaultRenditionOperation; - } - - public Object getData() { - if (this.updateItemToDefaultRenditionOperation != null) { - return this.updateItemToDefaultRenditionOperation; - } - - return null; - } - - @Nullable - public UpdateItemToDefaultRenditionOperation getUpdateItemToDefaultRenditionOperation() { - return updateItemToDefaultRenditionOperation; - } -} diff --git a/src/main/java/com/vertexvis/model/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.java b/src/main/java/com/vertexvis/model/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.java deleted file mode 100644 index de270f4..0000000 --- a/src/main/java/com/vertexvis/model/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vertexvis.model; - -import javax.annotation.Nullable; - -public class OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData { - - private WebhookEventSceneIncludedData sceneIncludedData; - private WebhookEventPartRevisionIncludedData partRevisionIncludedData; - - public OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData(WebhookEventSceneIncludedData data) { - this.sceneIncludedData = data; - } - - public OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData(WebhookEventPartRevisionIncludedData data) { - this.partRevisionIncludedData = data; - } - - public Object getData() { - if (this.sceneIncludedData != null) { - return this.sceneIncludedData; - } else if (this.partRevisionIncludedData != null) { - return this.partRevisionIncludedData; - } - - return null; - } - - @Nullable - public WebhookEventSceneIncludedData getSceneIncludedData() { - return this.sceneIncludedData; - } - - @Nullable - public WebhookEventPartRevisionIncludedData getPartRevisionIncludedData() { - return partRevisionIncludedData; - } -} diff --git a/src/main/java/com/vertexvis/model/Orientation.java b/src/main/java/com/vertexvis/model/Orientation.java index 07c4e3b..8092417 100644 --- a/src/main/java/com/vertexvis/model/Orientation.java +++ b/src/main/java/com/vertexvis/model/Orientation.java @@ -14,80 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Normals describing up & front directions */ -@ApiModel(description = "Normals describing up & front directions") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Orientation { public static final String SERIALIZED_NAME_UP = "up"; @SerializedName(SERIALIZED_NAME_UP) + @javax.annotation.Nonnull private Vector3 up; public static final String SERIALIZED_NAME_FRONT = "front"; @SerializedName(SERIALIZED_NAME_FRONT) + @javax.annotation.Nonnull private Vector3 front; - public Orientation() { + public Orientation() { } - public Orientation up(Vector3 up) { - + public Orientation up(@javax.annotation.Nonnull Vector3 up) { this.up = up; return this; } - /** + /** * Get up * @return up - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getUp() { return up; } - - public void setUp(Vector3 up) { + public void setUp(@javax.annotation.Nonnull Vector3 up) { this.up = up; } - public Orientation front(Vector3 front) { - + public Orientation front(@javax.annotation.Nonnull Vector3 front) { this.front = front; return this; } - /** + /** * Get front * @return front - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getFront() { return front; } - - public void setFront(Vector3 front) { + public void setFront(@javax.annotation.Nonnull Vector3 front) { this.front = front; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +142,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("up"); + openapiFields.add("front"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("up"); + openapiRequiredFields.add("front"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Orientation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Orientation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Orientation is not found in the empty JSON string", Orientation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Orientation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Orientation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Orientation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `up` + Vector3.validateJsonElement(jsonObj.get("up")); + // validate the required field `front` + Vector3.validateJsonElement(jsonObj.get("front")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Orientation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Orientation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Orientation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Orientation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Orientation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Orientation given an JSON string + * + * @param jsonString JSON string + * @return An instance of Orientation + * @throws IOException if the JSON string is invalid with respect to Orientation + */ + public static Orientation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Orientation.class); + } + + /** + * Convert an instance of Orientation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/OrthographicCamera.java b/src/main/java/com/vertexvis/model/OrthographicCamera.java index f0260d7..0b5ad15 100644 --- a/src/main/java/com/vertexvis/model/OrthographicCamera.java +++ b/src/main/java/com/vertexvis/model/OrthographicCamera.java @@ -14,162 +14,168 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * A camera type where an object's size stays consistent regardless of its distance to the camera. */ -@ApiModel(description = "A camera type where an object's size stays consistent regardless of its distance to the camera.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class OrthographicCamera { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; public static final String SERIALIZED_NAME_VIEW_VECTOR = "viewVector"; @SerializedName(SERIALIZED_NAME_VIEW_VECTOR) + @javax.annotation.Nonnull private Vector3 viewVector; public static final String SERIALIZED_NAME_LOOK_AT = "lookAt"; @SerializedName(SERIALIZED_NAME_LOOK_AT) + @javax.annotation.Nonnull private Vector3 lookAt; public static final String SERIALIZED_NAME_UP = "up"; @SerializedName(SERIALIZED_NAME_UP) + @javax.annotation.Nonnull private Vector3 up; public static final String SERIALIZED_NAME_FOV_HEIGHT = "fovHeight"; @SerializedName(SERIALIZED_NAME_FOV_HEIGHT) + @javax.annotation.Nonnull private BigDecimal fovHeight; - public OrthographicCamera() { + public OrthographicCamera() { } - public OrthographicCamera type(String type) { - + public OrthographicCamera type(@javax.annotation.Nullable String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "orthographic", value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nullable String type) { this.type = type; } - public OrthographicCamera viewVector(Vector3 viewVector) { - + public OrthographicCamera viewVector(@javax.annotation.Nonnull Vector3 viewVector) { this.viewVector = viewVector; return this; } - /** + /** * Get viewVector * @return viewVector - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getViewVector() { return viewVector; } - - public void setViewVector(Vector3 viewVector) { + public void setViewVector(@javax.annotation.Nonnull Vector3 viewVector) { this.viewVector = viewVector; } - public OrthographicCamera lookAt(Vector3 lookAt) { - + public OrthographicCamera lookAt(@javax.annotation.Nonnull Vector3 lookAt) { this.lookAt = lookAt; return this; } - /** + /** * Get lookAt * @return lookAt - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getLookAt() { return lookAt; } - - public void setLookAt(Vector3 lookAt) { + public void setLookAt(@javax.annotation.Nonnull Vector3 lookAt) { this.lookAt = lookAt; } - public OrthographicCamera up(Vector3 up) { - + public OrthographicCamera up(@javax.annotation.Nonnull Vector3 up) { this.up = up; return this; } - /** + /** * Get up * @return up - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getUp() { return up; } - - public void setUp(Vector3 up) { + public void setUp(@javax.annotation.Nonnull Vector3 up) { this.up = up; } - public OrthographicCamera fovHeight(BigDecimal fovHeight) { - + public OrthographicCamera fovHeight(@javax.annotation.Nonnull BigDecimal fovHeight) { this.fovHeight = fovHeight; return this; } - /** + /** * Get fovHeight * @return fovHeight - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public BigDecimal getFovHeight() { return fovHeight; } - - public void setFovHeight(BigDecimal fovHeight) { + public void setFovHeight(@javax.annotation.Nonnull BigDecimal fovHeight) { this.fovHeight = fovHeight; } + @Override public boolean equals(Object o) { if (this == o) { @@ -215,5 +221,113 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("viewVector"); + openapiFields.add("lookAt"); + openapiFields.add("up"); + openapiFields.add("fovHeight"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("viewVector"); + openapiRequiredFields.add("lookAt"); + openapiRequiredFields.add("up"); + openapiRequiredFields.add("fovHeight"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrthographicCamera + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrthographicCamera.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrthographicCamera is not found in the empty JSON string", OrthographicCamera.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrthographicCamera.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrthographicCamera` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrthographicCamera.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `viewVector` + Vector3.validateJsonElement(jsonObj.get("viewVector")); + // validate the required field `lookAt` + Vector3.validateJsonElement(jsonObj.get("lookAt")); + // validate the required field `up` + Vector3.validateJsonElement(jsonObj.get("up")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrthographicCamera.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrthographicCamera' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrthographicCamera.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrthographicCamera value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrthographicCamera read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrthographicCamera given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrthographicCamera + * @throws IOException if the JSON string is invalid with respect to OrthographicCamera + */ + public static OrthographicCamera fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrthographicCamera.class); + } + + /** + * Convert an instance of OrthographicCamera to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Part.java b/src/main/java/com/vertexvis/model/Part.java index c1a5a23..abd9296 100644 --- a/src/main/java/com/vertexvis/model/Part.java +++ b/src/main/java/com/vertexvis/model/Part.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,59 +22,79 @@ import com.vertexvis.model.Link; import com.vertexvis.model.PartData; import com.vertexvis.model.PartRevisionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Part */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Part { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartData data; public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) - private List included = null; + @javax.annotation.Nullable + private List included = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Part() { + public Part() { } - public Part data(PartData data) { - + public Part data(@javax.annotation.Nonnull PartData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartData getData() { return data; } - - public void setData(PartData data) { + public void setData(@javax.annotation.Nonnull PartData data) { this.data = data; } - public Part included(List included) { - + public Part included(@javax.annotation.Nullable List included) { this.included = included; return this; } @@ -88,25 +107,21 @@ public Part addIncludedItem(PartRevisionData includedItem) { return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nullable List included) { this.included = included; } - public Part links(Map links) { - + public Part links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -119,23 +134,21 @@ public Part putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -177,5 +190,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Part + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Part.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Part is not found in the empty JSON string", Part.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Part.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Part` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Part.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartData.validateJsonElement(jsonObj.get("data")); + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + PartRevisionData.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Part.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Part' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Part.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Part value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Part read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Part given an JSON string + * + * @param jsonString JSON string + * @return An instance of Part + * @throws IOException if the JSON string is invalid with respect to Part + */ + public static Part fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Part.class); + } + + /** + * Convert an instance of Part to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartAssemblyRelationship.java b/src/main/java/com/vertexvis/model/PartAssemblyRelationship.java index c4d8209..8ec667b 100644 --- a/src/main/java/com/vertexvis/model/PartAssemblyRelationship.java +++ b/src/main/java/com/vertexvis/model/PartAssemblyRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PartAssemblyRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Create Part Assembly */ -@ApiModel(description = "Create Part Assembly") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartAssemblyRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartAssemblyRelationshipData data; - public PartAssemblyRelationship() { + public PartAssemblyRelationship() { } - public PartAssemblyRelationship data(PartAssemblyRelationshipData data) { - + public PartAssemblyRelationship data(@javax.annotation.Nonnull PartAssemblyRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartAssemblyRelationshipData getData() { return data; } - - public void setData(PartAssemblyRelationshipData data) { + public void setData(@javax.annotation.Nonnull PartAssemblyRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartAssemblyRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartAssemblyRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartAssemblyRelationship is not found in the empty JSON string", PartAssemblyRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartAssemblyRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartAssemblyRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartAssemblyRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartAssemblyRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartAssemblyRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartAssemblyRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartAssemblyRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartAssemblyRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartAssemblyRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartAssemblyRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartAssemblyRelationship + * @throws IOException if the JSON string is invalid with respect to PartAssemblyRelationship + */ + public static PartAssemblyRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartAssemblyRelationship.class); + } + + /** + * Convert an instance of PartAssemblyRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java b/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java index 48b0afe..071e42a 100644 --- a/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java +++ b/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java @@ -14,73 +14,94 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; import com.vertexvis.model.PartRevisionInstance; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartAssemblyRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartAssemblyRelationshipData { public static final String SERIALIZED_NAME_CHILDREN = "children"; @SerializedName(SERIALIZED_NAME_CHILDREN) + @javax.annotation.Nonnull private List children = new ArrayList<>(); public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); - public PartAssemblyRelationshipData() { + public PartAssemblyRelationshipData() { } - public PartAssemblyRelationshipData children(List children) { - + public PartAssemblyRelationshipData children(@javax.annotation.Nonnull List children) { this.children = children; return this; } public PartAssemblyRelationshipData addChildrenItem(PartRevisionInstance childrenItem) { + if (this.children == null) { + this.children = new ArrayList<>(); + } this.children.add(childrenItem); return this; } - /** + /** * Get children * @return children - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getChildren() { return children; } - - public void setChildren(List children) { + public void setChildren(@javax.annotation.Nonnull List children) { this.children = children; } - public PartAssemblyRelationshipData metadata(Map metadata) { - + public PartAssemblyRelationshipData metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public PartAssemblyRelationshipData putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public PartAssemblyRelationshipData putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -88,23 +109,21 @@ public PartAssemblyRelationshipData putMetadataItem(String key, AnyOfMetadataLon return this; } - /** + /** * Additional metadata about the `part` and/or `part-revision`. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Additional metadata about the `part` and/or `part-revision`. ") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } + @Override public boolean equals(Object o) { if (this == o) { @@ -144,5 +163,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("children"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("children"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartAssemblyRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartAssemblyRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartAssemblyRelationshipData is not found in the empty JSON string", PartAssemblyRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartAssemblyRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartAssemblyRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartAssemblyRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("children").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `children` to be an array in the JSON string but got `%s`", jsonObj.get("children").toString())); + } + + JsonArray jsonArraychildren = jsonObj.getAsJsonArray("children"); + // validate the required field `children` (array) + for (int i = 0; i < jsonArraychildren.size(); i++) { + PartRevisionInstance.validateJsonElement(jsonArraychildren.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartAssemblyRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartAssemblyRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartAssemblyRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartAssemblyRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartAssemblyRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartAssemblyRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartAssemblyRelationshipData + * @throws IOException if the JSON string is invalid with respect to PartAssemblyRelationshipData + */ + public static PartAssemblyRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartAssemblyRelationshipData.class); + } + + /** + * Convert an instance of PartAssemblyRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartData.java b/src/main/java/com/vertexvis/model/PartData.java index bfb53ec..c83d14f 100644 --- a/src/main/java/com/vertexvis/model/PartData.java +++ b/src/main/java/com/vertexvis/model/PartData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.PartDataAttributes; import com.vertexvis.model.PartDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private PartDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private PartDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public PartData() { + public PartData() { } - public PartData type(String type) { - + public PartData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public PartData id(UUID id) { - + public PartData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public PartData attributes(PartDataAttributes attributes) { - + public PartData attributes(@javax.annotation.Nonnull PartDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartDataAttributes getAttributes() { return attributes; } - - public void setAttributes(PartDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull PartDataAttributes attributes) { this.attributes = attributes; } - public PartData relationships(PartDataRelationships relationships) { - + public PartData relationships(@javax.annotation.Nullable PartDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartDataRelationships getRelationships() { return relationships; } - - public void setRelationships(PartDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable PartDataRelationships relationships) { this.relationships = relationships; } - public PartData links(Map links) { - + public PartData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public PartData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartData is not found in the empty JSON string", PartData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + PartDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + PartDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartData + * @throws IOException if the JSON string is invalid with respect to PartData + */ + public static PartData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartData.class); + } + + /** + * Convert an instance of PartData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartDataAttributes.java b/src/main/java/com/vertexvis/model/PartDataAttributes.java index 13be1e3..3405f08 100644 --- a/src/main/java/com/vertexvis/model/PartDataAttributes.java +++ b/src/main/java/com/vertexvis/model/PartDataAttributes.java @@ -14,106 +14,119 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nonnull private String suppliedId; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; - public PartDataAttributes() { + public PartDataAttributes() { } - public PartDataAttributes name(String name) { - + public PartDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nonnull String name) { this.name = name; } - public PartDataAttributes suppliedId(String suppliedId) { - + public PartDataAttributes suppliedId(@javax.annotation.Nonnull String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nonnull String suppliedId) { this.suppliedId = suppliedId; } - public PartDataAttributes created(OffsetDateTime created) { - + public PartDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } + @Override public boolean equals(Object o) { if (this == o) { @@ -155,5 +168,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + openapiFields.add("created"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("suppliedId"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartDataAttributes is not found in the empty JSON string", PartDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartDataAttributes + * @throws IOException if the JSON string is invalid with respect to PartDataAttributes + */ + public static PartDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartDataAttributes.class); + } + + /** + * Convert an instance of PartDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartDataRelationships.java b/src/main/java/com/vertexvis/model/PartDataRelationships.java index 342b2cf..5b36d1f 100644 --- a/src/main/java/com/vertexvis/model/PartDataRelationships.java +++ b/src/main/java/com/vertexvis/model/PartDataRelationships.java @@ -14,59 +14,81 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PartDataRelationshipsPartRevisions; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartDataRelationships { public static final String SERIALIZED_NAME_PART_REVISIONS = "partRevisions"; @SerializedName(SERIALIZED_NAME_PART_REVISIONS) + @javax.annotation.Nonnull private List partRevisions = new ArrayList<>(); - public PartDataRelationships() { + public PartDataRelationships() { } - public PartDataRelationships partRevisions(List partRevisions) { - + public PartDataRelationships partRevisions(@javax.annotation.Nonnull List partRevisions) { this.partRevisions = partRevisions; return this; } public PartDataRelationships addPartRevisionsItem(PartDataRelationshipsPartRevisions partRevisionsItem) { + if (this.partRevisions == null) { + this.partRevisions = new ArrayList<>(); + } this.partRevisions.add(partRevisionsItem); return this; } - /** + /** * Get partRevisions * @return partRevisions - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getPartRevisions() { return partRevisions; } - - public void setPartRevisions(List partRevisions) { + public void setPartRevisions(@javax.annotation.Nonnull List partRevisions) { this.partRevisions = partRevisions; } + @Override public boolean equals(Object o) { if (this == o) { @@ -104,5 +126,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("partRevisions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("partRevisions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartDataRelationships is not found in the empty JSON string", PartDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("partRevisions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `partRevisions` to be an array in the JSON string but got `%s`", jsonObj.get("partRevisions").toString())); + } + + JsonArray jsonArraypartRevisions = jsonObj.getAsJsonArray("partRevisions"); + // validate the required field `partRevisions` (array) + for (int i = 0; i < jsonArraypartRevisions.size(); i++) { + PartDataRelationshipsPartRevisions.validateJsonElement(jsonArraypartRevisions.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartDataRelationships + * @throws IOException if the JSON string is invalid with respect to PartDataRelationships + */ + public static PartDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartDataRelationships.class); + } + + /** + * Convert an instance of PartDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java b/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java index fbdcc0f..c4b7d42 100644 --- a/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java +++ b/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartDataRelationshipsPartRevisions */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartDataRelationshipsPartRevisions { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public PartDataRelationshipsPartRevisions() { + public PartDataRelationshipsPartRevisions() { } - public PartDataRelationshipsPartRevisions type(TypeEnum type) { - + public PartDataRelationshipsPartRevisions type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-revision", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public PartDataRelationshipsPartRevisions id(UUID id) { - + public PartDataRelationshipsPartRevisions id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartDataRelationshipsPartRevisions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartDataRelationshipsPartRevisions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartDataRelationshipsPartRevisions is not found in the empty JSON string", PartDataRelationshipsPartRevisions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartDataRelationshipsPartRevisions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartDataRelationshipsPartRevisions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartDataRelationshipsPartRevisions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartDataRelationshipsPartRevisions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartDataRelationshipsPartRevisions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartDataRelationshipsPartRevisions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartDataRelationshipsPartRevisions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartDataRelationshipsPartRevisions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartDataRelationshipsPartRevisions given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartDataRelationshipsPartRevisions + * @throws IOException if the JSON string is invalid with respect to PartDataRelationshipsPartRevisions + */ + public static PartDataRelationshipsPartRevisions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartDataRelationshipsPartRevisions.class); + } + + /** + * Convert an instance of PartDataRelationshipsPartRevisions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartInstanceRelationship.java b/src/main/java/com/vertexvis/model/PartInstanceRelationship.java new file mode 100644 index 0000000..e1a3757 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartInstanceRelationship.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PartInstanceRelationshipData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * Relationship to a `part-instance`. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartInstanceRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private PartInstanceRelationshipData data; + + public PartInstanceRelationship() { + } + + public PartInstanceRelationship data(@javax.annotation.Nonnull PartInstanceRelationshipData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public PartInstanceRelationshipData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull PartInstanceRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartInstanceRelationship partInstanceRelationship = (PartInstanceRelationship) o; + return Objects.equals(this.data, partInstanceRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartInstanceRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartInstanceRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartInstanceRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartInstanceRelationship is not found in the empty JSON string", PartInstanceRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartInstanceRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartInstanceRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartInstanceRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartInstanceRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartInstanceRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartInstanceRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartInstanceRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartInstanceRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartInstanceRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartInstanceRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartInstanceRelationship + * @throws IOException if the JSON string is invalid with respect to PartInstanceRelationship + */ + public static PartInstanceRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartInstanceRelationship.class); + } + + /** + * Convert an instance of PartInstanceRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java b/src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java new file mode 100644 index 0000000..8b9dfbf --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java @@ -0,0 +1,298 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PartInstanceRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartInstanceRelationshipData { + /** + * Resource object type. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PART_INSTANCE("part-instance"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public PartInstanceRelationshipData() { + } + + public PartInstanceRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PartInstanceRelationshipData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartInstanceRelationshipData partInstanceRelationshipData = (PartInstanceRelationshipData) o; + return Objects.equals(this.type, partInstanceRelationshipData.type) && + Objects.equals(this.id, partInstanceRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartInstanceRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartInstanceRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartInstanceRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartInstanceRelationshipData is not found in the empty JSON string", PartInstanceRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartInstanceRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartInstanceRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartInstanceRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartInstanceRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartInstanceRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartInstanceRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartInstanceRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartInstanceRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartInstanceRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartInstanceRelationshipData + * @throws IOException if the JSON string is invalid with respect to PartInstanceRelationshipData + */ + public static PartInstanceRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartInstanceRelationshipData.class); + } + + /** + * Convert an instance of PartInstanceRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartList.java b/src/main/java/com/vertexvis/model/PartList.java index 860e375..2825e7c 100644 --- a/src/main/java/com/vertexvis/model/PartList.java +++ b/src/main/java/com/vertexvis/model/PartList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.PartData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public PartList() { + public PartList() { } - public PartList data(List data) { - + public PartList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public PartList addDataItem(PartData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public PartList links(Map links) { - + public PartList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public PartList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartList is not found in the empty JSON string", PartList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PartData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartList + * @throws IOException if the JSON string is invalid with respect to PartList + */ + public static PartList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartList.class); + } + + /** + * Convert an instance of PartList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRelationshipData.java b/src/main/java/com/vertexvis/model/PartRelationshipData.java index a5dcc51..912eec9 100644 --- a/src/main/java/com/vertexvis/model/PartRelationshipData.java +++ b/src/main/java/com/vertexvis/model/PartRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public PartRelationshipData() { + public PartRelationshipData() { } - public PartRelationshipData type(TypeEnum type) { - + public PartRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public PartRelationshipData id(UUID id) { - + public PartRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRelationshipData is not found in the empty JSON string", PartRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRelationshipData + * @throws IOException if the JSON string is invalid with respect to PartRelationshipData + */ + public static PartRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRelationshipData.class); + } + + /** + * Convert an instance of PartRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRendition.java b/src/main/java/com/vertexvis/model/PartRendition.java index 34bcb7e..3ac07e1 100644 --- a/src/main/java/com/vertexvis/model/PartRendition.java +++ b/src/main/java/com/vertexvis/model/PartRendition.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.PartRenditionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRendition */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRendition { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartRenditionData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public PartRendition() { + public PartRendition() { } - public PartRendition data(PartRenditionData data) { - + public PartRendition data(@javax.annotation.Nonnull PartRenditionData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRenditionData getData() { return data; } - - public void setData(PartRenditionData data) { + public void setData(@javax.annotation.Nonnull PartRenditionData data) { this.data = data; } - public PartRendition links(Map links) { - + public PartRendition links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public PartRendition putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRendition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRendition.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRendition is not found in the empty JSON string", PartRendition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRendition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRendition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRendition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartRenditionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRendition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRendition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRendition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRendition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRendition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRendition given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRendition + * @throws IOException if the JSON string is invalid with respect to PartRendition + */ + public static PartRendition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRendition.class); + } + + /** + * Convert an instance of PartRendition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionData.java b/src/main/java/com/vertexvis/model/PartRenditionData.java index 2457a9d..78a08b5 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionData.java +++ b/src/main/java/com/vertexvis/model/PartRenditionData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.PartRenditionDataAttributes; import com.vertexvis.model.PartRenditionDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRenditionData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private PartRenditionDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private PartRenditionDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public PartRenditionData() { + public PartRenditionData() { } - public PartRenditionData type(String type) { - + public PartRenditionData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-rendition", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public PartRenditionData id(UUID id) { - + public PartRenditionData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public PartRenditionData attributes(PartRenditionDataAttributes attributes) { - + public PartRenditionData attributes(@javax.annotation.Nonnull PartRenditionDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRenditionDataAttributes getAttributes() { return attributes; } - - public void setAttributes(PartRenditionDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull PartRenditionDataAttributes attributes) { this.attributes = attributes; } - public PartRenditionData relationships(PartRenditionDataRelationships relationships) { - + public PartRenditionData relationships(@javax.annotation.Nonnull PartRenditionDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRenditionDataRelationships getRelationships() { return relationships; } - - public void setRelationships(PartRenditionDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull PartRenditionDataRelationships relationships) { this.relationships = relationships; } - public PartRenditionData links(Map links) { - + public PartRenditionData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public PartRenditionData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionData is not found in the empty JSON string", PartRenditionData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRenditionData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + PartRenditionDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + PartRenditionDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionData + * @throws IOException if the JSON string is invalid with respect to PartRenditionData + */ + public static PartRenditionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionData.class); + } + + /** + * Convert an instance of PartRenditionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionDataAttributes.java b/src/main/java/com/vertexvis/model/PartRenditionDataAttributes.java index 2d144cf..0c12370 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionDataAttributes.java +++ b/src/main/java/com/vertexvis/model/PartRenditionDataAttributes.java @@ -14,106 +14,119 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRenditionDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; - public PartRenditionDataAttributes() { + public PartRenditionDataAttributes() { } - public PartRenditionDataAttributes created(OffsetDateTime created) { - + public PartRenditionDataAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public PartRenditionDataAttributes suppliedId(String suppliedId) { - + public PartRenditionDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public PartRenditionDataAttributes name(String name) { - + public PartRenditionDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { @@ -155,5 +168,97 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("suppliedId"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionDataAttributes is not found in the empty JSON string", PartRenditionDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionDataAttributes + * @throws IOException if the JSON string is invalid with respect to PartRenditionDataAttributes + */ + public static PartRenditionDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionDataAttributes.class); + } + + /** + * Convert an instance of PartRenditionDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionDataRelationships.java b/src/main/java/com/vertexvis/model/PartRenditionDataRelationships.java index cc06645..aaab8ed 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionDataRelationships.java +++ b/src/main/java/com/vertexvis/model/PartRenditionDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.GeometrySetRelationshipData; import com.vertexvis.model.PartRevisionRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRenditionDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionDataRelationships { public static final String SERIALIZED_NAME_GEOMETRY_SET = "geometrySet"; @SerializedName(SERIALIZED_NAME_GEOMETRY_SET) + @javax.annotation.Nullable private GeometrySetRelationshipData geometrySet; public static final String SERIALIZED_NAME_PART_REVISION = "partRevision"; @SerializedName(SERIALIZED_NAME_PART_REVISION) + @javax.annotation.Nullable private PartRevisionRelationship partRevision; - public PartRenditionDataRelationships() { + public PartRenditionDataRelationships() { } - public PartRenditionDataRelationships geometrySet(GeometrySetRelationshipData geometrySet) { - + public PartRenditionDataRelationships geometrySet(@javax.annotation.Nullable GeometrySetRelationshipData geometrySet) { this.geometrySet = geometrySet; return this; } - /** + /** * Get geometrySet * @return geometrySet - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public GeometrySetRelationshipData getGeometrySet() { return geometrySet; } - - public void setGeometrySet(GeometrySetRelationshipData geometrySet) { + public void setGeometrySet(@javax.annotation.Nullable GeometrySetRelationshipData geometrySet) { this.geometrySet = geometrySet; } - public PartRenditionDataRelationships partRevision(PartRevisionRelationship partRevision) { - + public PartRenditionDataRelationships partRevision(@javax.annotation.Nullable PartRevisionRelationship partRevision) { this.partRevision = partRevision; return this; } - /** + /** * Get partRevision * @return partRevision - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRevisionRelationship getPartRevision() { return partRevision; } - - public void setPartRevision(PartRevisionRelationship partRevision) { + public void setPartRevision(@javax.annotation.Nullable PartRevisionRelationship partRevision) { this.partRevision = partRevision; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,98 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("geometrySet"); + openapiFields.add("partRevision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionDataRelationships is not found in the empty JSON string", PartRenditionDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `geometrySet` + if (jsonObj.get("geometrySet") != null && !jsonObj.get("geometrySet").isJsonNull()) { + GeometrySetRelationshipData.validateJsonElement(jsonObj.get("geometrySet")); + } + // validate the optional field `partRevision` + if (jsonObj.get("partRevision") != null && !jsonObj.get("partRevision").isJsonNull()) { + PartRevisionRelationship.validateJsonElement(jsonObj.get("partRevision")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionDataRelationships + * @throws IOException if the JSON string is invalid with respect to PartRenditionDataRelationships + */ + public static PartRenditionDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionDataRelationships.class); + } + + /** + * Convert an instance of PartRenditionDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionList.java b/src/main/java/com/vertexvis/model/PartRenditionList.java index b0bbfc7..771271f 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionList.java +++ b/src/main/java/com/vertexvis/model/PartRenditionList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.PartRenditionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRenditionList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public PartRenditionList() { + public PartRenditionList() { } - public PartRenditionList data(List data) { - + public PartRenditionList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public PartRenditionList addDataItem(PartRenditionData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public PartRenditionList links(Map links) { - + public PartRenditionList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public PartRenditionList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionList is not found in the empty JSON string", PartRenditionList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRenditionList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PartRenditionData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionList + * @throws IOException if the JSON string is invalid with respect to PartRenditionList + */ + public static PartRenditionList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionList.class); + } + + /** + * Convert an instance of PartRenditionList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionRelationship.java b/src/main/java/com/vertexvis/model/PartRenditionRelationship.java index e61fb63..81b6677 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionRelationship.java +++ b/src/main/java/com/vertexvis/model/PartRenditionRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PartRenditionRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `part-rendition`. */ -@ApiModel(description = "Relationship to a `part-rendition`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartRenditionRelationshipData data; - public PartRenditionRelationship() { + public PartRenditionRelationship() { } - public PartRenditionRelationship data(PartRenditionRelationshipData data) { - + public PartRenditionRelationship data(@javax.annotation.Nonnull PartRenditionRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRenditionRelationshipData getData() { return data; } - - public void setData(PartRenditionRelationshipData data) { + public void setData(@javax.annotation.Nonnull PartRenditionRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionRelationship is not found in the empty JSON string", PartRenditionRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRenditionRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartRenditionRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionRelationship + * @throws IOException if the JSON string is invalid with respect to PartRenditionRelationship + */ + public static PartRenditionRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionRelationship.class); + } + + /** + * Convert an instance of PartRenditionRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRenditionRelationshipData.java b/src/main/java/com/vertexvis/model/PartRenditionRelationshipData.java index 5d412e9..671be90 100644 --- a/src/main/java/com/vertexvis/model/PartRenditionRelationshipData.java +++ b/src/main/java/com/vertexvis/model/PartRenditionRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRenditionRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRenditionRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public PartRenditionRelationshipData() { + public PartRenditionRelationshipData() { } - public PartRenditionRelationshipData type(TypeEnum type) { - + public PartRenditionRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-rendition", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public PartRenditionRelationshipData id(UUID id) { - + public PartRenditionRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRenditionRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRenditionRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRenditionRelationshipData is not found in the empty JSON string", PartRenditionRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRenditionRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRenditionRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRenditionRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRenditionRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRenditionRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRenditionRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRenditionRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRenditionRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRenditionRelationshipData + * @throws IOException if the JSON string is invalid with respect to PartRenditionRelationshipData + */ + public static PartRenditionRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRenditionRelationshipData.class); + } + + /** + * Convert an instance of PartRenditionRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevision.java b/src/main/java/com/vertexvis/model/PartRevision.java index 9e28e97..9d97a2b 100644 --- a/src/main/java/com/vertexvis/model/PartRevision.java +++ b/src/main/java/com/vertexvis/model/PartRevision.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.PartRevisionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRevision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevision { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartRevisionData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public PartRevision() { + public PartRevision() { } - public PartRevision data(PartRevisionData data) { - + public PartRevision data(@javax.annotation.Nonnull PartRevisionData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRevisionData getData() { return data; } - - public void setData(PartRevisionData data) { + public void setData(@javax.annotation.Nonnull PartRevisionData data) { this.data = data; } - public PartRevision links(Map links) { - + public PartRevision links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public PartRevision putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevision + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevision.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevision is not found in the empty JSON string", PartRevision.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevision.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevision` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevision.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartRevisionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevision.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevision' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevision.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevision value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevision read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevision given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevision + * @throws IOException if the JSON string is invalid with respect to PartRevision + */ + public static PartRevision fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevision.class); + } + + /** + * Convert an instance of PartRevision to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionData.java b/src/main/java/com/vertexvis/model/PartRevisionData.java index 015f424..9e5c6a3 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionData.java +++ b/src/main/java/com/vertexvis/model/PartRevisionData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.PartRevisionDataAttributes; import com.vertexvis.model.PartRevisionDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRevisionData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private PartRevisionDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private PartRevisionDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public PartRevisionData() { + public PartRevisionData() { } - public PartRevisionData type(String type) { - + public PartRevisionData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-revision", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public PartRevisionData id(UUID id) { - + public PartRevisionData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public PartRevisionData attributes(PartRevisionDataAttributes attributes) { - + public PartRevisionData attributes(@javax.annotation.Nonnull PartRevisionDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRevisionDataAttributes getAttributes() { return attributes; } - - public void setAttributes(PartRevisionDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull PartRevisionDataAttributes attributes) { this.attributes = attributes; } - public PartRevisionData relationships(PartRevisionDataRelationships relationships) { - + public PartRevisionData relationships(@javax.annotation.Nonnull PartRevisionDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartRevisionDataRelationships getRelationships() { return relationships; } - - public void setRelationships(PartRevisionDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull PartRevisionDataRelationships relationships) { this.relationships = relationships; } - public PartRevisionData links(Map links) { - + public PartRevisionData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public PartRevisionData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionData is not found in the empty JSON string", PartRevisionData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + PartRevisionDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + PartRevisionDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionData + * @throws IOException if the JSON string is invalid with respect to PartRevisionData + */ + public static PartRevisionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionData.class); + } + + /** + * Convert an instance of PartRevisionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java b/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java index d550a45..abeb2ad 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java +++ b/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java @@ -14,75 +14,99 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRevisionDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; + public static final String SERIALIZED_NAME_SUPPLIED_ITERATION_ID = "suppliedIterationId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ITERATION_ID) + @javax.annotation.Nullable + private String suppliedIterationId; + public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; - public PartRevisionDataAttributes() { + public PartRevisionDataAttributes() { } - public PartRevisionDataAttributes created(OffsetDateTime created) { - + public PartRevisionDataAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public PartRevisionDataAttributes metadata(Map metadata) { - + public PartRevisionDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public PartRevisionDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public PartRevisionDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -90,69 +114,78 @@ public PartRevisionDataAttributes putMetadataItem(String key, AnyOfMetadataLongT return this; } - /** + /** * Get metadata * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } - public PartRevisionDataAttributes suppliedId(String suppliedId) { - + public PartRevisionDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public PartRevisionDataAttributes name(String name) { - + public PartRevisionDataAttributes suppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + return this; + } + + /** + * Get suppliedIterationId + * @return suppliedIterationId + */ + @javax.annotation.Nullable + public String getSuppliedIterationId() { + return suppliedIterationId; + } + + public void setSuppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + } + + + public PartRevisionDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { @@ -165,12 +198,13 @@ public boolean equals(Object o) { return Objects.equals(this.created, partRevisionDataAttributes.created) && Objects.equals(this.metadata, partRevisionDataAttributes.metadata) && Objects.equals(this.suppliedId, partRevisionDataAttributes.suppliedId) && + Objects.equals(this.suppliedIterationId, partRevisionDataAttributes.suppliedIterationId) && Objects.equals(this.name, partRevisionDataAttributes.name); } @Override public int hashCode() { - return Objects.hash(created, metadata, suppliedId, name); + return Objects.hash(created, metadata, suppliedId, suppliedIterationId, name); } @Override @@ -180,6 +214,7 @@ public String toString() { sb.append(" created: ").append(toIndentedString(created)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append(" suppliedIterationId: ").append(toIndentedString(suppliedIterationId)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); @@ -196,5 +231,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("metadata"); + openapiFields.add("suppliedId"); + openapiFields.add("suppliedIterationId"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionDataAttributes is not found in the empty JSON string", PartRevisionDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("suppliedIterationId") != null && !jsonObj.get("suppliedIterationId").isJsonNull()) && !jsonObj.get("suppliedIterationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedIterationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedIterationId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionDataAttributes + * @throws IOException if the JSON string is invalid with respect to PartRevisionDataAttributes + */ + public static PartRevisionDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionDataAttributes.class); + } + + /** + * Convert an instance of PartRevisionDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionDataRelationships.java b/src/main/java/com/vertexvis/model/PartRevisionDataRelationships.java index 15bb94a..dc37b50 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionDataRelationships.java +++ b/src/main/java/com/vertexvis/model/PartRevisionDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,99 +22,113 @@ import com.vertexvis.model.GeometrySetRelationshipData; import com.vertexvis.model.PartRelationshipData; import com.vertexvis.model.PartRenditionRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * PartRevisionDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionDataRelationships { public static final String SERIALIZED_NAME_GEOMETRY_SET = "geometrySet"; @SerializedName(SERIALIZED_NAME_GEOMETRY_SET) + @javax.annotation.Nullable private GeometrySetRelationshipData geometrySet; public static final String SERIALIZED_NAME_PART = "part"; @SerializedName(SERIALIZED_NAME_PART) + @javax.annotation.Nullable private PartRelationshipData part; public static final String SERIALIZED_NAME_DEFAULT_PART_RENDITION = "defaultPartRendition"; @SerializedName(SERIALIZED_NAME_DEFAULT_PART_RENDITION) + @javax.annotation.Nullable private PartRenditionRelationship defaultPartRendition; - public PartRevisionDataRelationships() { + public PartRevisionDataRelationships() { } - public PartRevisionDataRelationships geometrySet(GeometrySetRelationshipData geometrySet) { - + public PartRevisionDataRelationships geometrySet(@javax.annotation.Nullable GeometrySetRelationshipData geometrySet) { this.geometrySet = geometrySet; return this; } - /** + /** * Get geometrySet * @return geometrySet - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public GeometrySetRelationshipData getGeometrySet() { return geometrySet; } - - public void setGeometrySet(GeometrySetRelationshipData geometrySet) { + public void setGeometrySet(@javax.annotation.Nullable GeometrySetRelationshipData geometrySet) { this.geometrySet = geometrySet; } - public PartRevisionDataRelationships part(PartRelationshipData part) { - + public PartRevisionDataRelationships part(@javax.annotation.Nullable PartRelationshipData part) { this.part = part; return this; } - /** + /** * Get part * @return part - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRelationshipData getPart() { return part; } - - public void setPart(PartRelationshipData part) { + public void setPart(@javax.annotation.Nullable PartRelationshipData part) { this.part = part; } - public PartRevisionDataRelationships defaultPartRendition(PartRenditionRelationship defaultPartRendition) { - + public PartRevisionDataRelationships defaultPartRendition(@javax.annotation.Nullable PartRenditionRelationship defaultPartRendition) { this.defaultPartRendition = defaultPartRendition; return this; } - /** + /** * Get defaultPartRendition * @return defaultPartRendition - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRenditionRelationship getDefaultPartRendition() { return defaultPartRendition; } - - public void setDefaultPartRendition(PartRenditionRelationship defaultPartRendition) { + public void setDefaultPartRendition(@javax.annotation.Nullable PartRenditionRelationship defaultPartRendition) { this.defaultPartRendition = defaultPartRendition; } + @Override public boolean equals(Object o) { if (this == o) { @@ -157,5 +170,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("geometrySet"); + openapiFields.add("part"); + openapiFields.add("defaultPartRendition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionDataRelationships is not found in the empty JSON string", PartRevisionDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `geometrySet` + if (jsonObj.get("geometrySet") != null && !jsonObj.get("geometrySet").isJsonNull()) { + GeometrySetRelationshipData.validateJsonElement(jsonObj.get("geometrySet")); + } + // validate the optional field `part` + if (jsonObj.get("part") != null && !jsonObj.get("part").isJsonNull()) { + PartRelationshipData.validateJsonElement(jsonObj.get("part")); + } + // validate the optional field `defaultPartRendition` + if (jsonObj.get("defaultPartRendition") != null && !jsonObj.get("defaultPartRendition").isJsonNull()) { + PartRenditionRelationship.validateJsonElement(jsonObj.get("defaultPartRendition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionDataRelationships + * @throws IOException if the JSON string is invalid with respect to PartRevisionDataRelationships + */ + public static PartRevisionDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionDataRelationships.class); + } + + /** + * Convert an instance of PartRevisionDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionInstance.java b/src/main/java/com/vertexvis/model/PartRevisionInstance.java index 90bf898..dcaa924 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionInstance.java +++ b/src/main/java/com/vertexvis/model/PartRevisionInstance.java @@ -14,136 +14,145 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * A reference to an existing PartRevision. Specify one and only one of referenceId or suppliedReferenceId to refer to a revision. */ -@ApiModel(description = "A reference to an existing PartRevision. Specify one and only one of referenceId or suppliedReferenceId to refer to a revision.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionInstance { public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nonnull private Integer ordinal; public static final String SERIALIZED_NAME_REVISION_ID = "revisionId"; @SerializedName(SERIALIZED_NAME_REVISION_ID) + @javax.annotation.Nullable private UUID revisionId; public static final String SERIALIZED_NAME_SUPPLIED_REVISION_ID = "suppliedRevisionId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_REVISION_ID) + @javax.annotation.Nullable private String suppliedRevisionId; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; - public PartRevisionInstance() { + public PartRevisionInstance() { } - public PartRevisionInstance ordinal(Integer ordinal) { - + public PartRevisionInstance ordinal(@javax.annotation.Nonnull Integer ordinal) { this.ordinal = ordinal; return this; } - /** + /** * A 0-based index used for defining a consistent ordering for children of an assembly * minimum: 0 * @return ordinal - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A 0-based index used for defining a consistent ordering for children of an assembly") - public Integer getOrdinal() { return ordinal; } - - public void setOrdinal(Integer ordinal) { + public void setOrdinal(@javax.annotation.Nonnull Integer ordinal) { this.ordinal = ordinal; } - public PartRevisionInstance revisionId(UUID revisionId) { - + public PartRevisionInstance revisionId(@javax.annotation.Nullable UUID revisionId) { this.revisionId = revisionId; return this; } - /** + /** * ID of the resource. * @return revisionId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", value = "ID of the resource.") - public UUID getRevisionId() { return revisionId; } - - public void setRevisionId(UUID revisionId) { + public void setRevisionId(@javax.annotation.Nullable UUID revisionId) { this.revisionId = revisionId; } - public PartRevisionInstance suppliedRevisionId(String suppliedRevisionId) { - + public PartRevisionInstance suppliedRevisionId(@javax.annotation.Nullable String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; return this; } - /** + /** * Get suppliedRevisionId * @return suppliedRevisionId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedRevisionId() { return suppliedRevisionId; } - - public void setSuppliedRevisionId(String suppliedRevisionId) { + public void setSuppliedRevisionId(@javax.annotation.Nullable String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; } - public PartRevisionInstance transform(Matrix4 transform) { - + public PartRevisionInstance transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } + @Override public boolean equals(Object o) { if (this == o) { @@ -187,5 +196,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ordinal"); + openapiFields.add("revisionId"); + openapiFields.add("suppliedRevisionId"); + openapiFields.add("transform"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("ordinal"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionInstance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionInstance.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionInstance is not found in the empty JSON string", PartRevisionInstance.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionInstance.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionInstance` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionInstance.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("revisionId") != null && !jsonObj.get("revisionId").isJsonNull()) && !jsonObj.get("revisionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revisionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revisionId").toString())); + } + if ((jsonObj.get("suppliedRevisionId") != null && !jsonObj.get("suppliedRevisionId").isJsonNull()) && !jsonObj.get("suppliedRevisionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedRevisionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedRevisionId").toString())); + } + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionInstance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionInstance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionInstance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionInstance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionInstance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionInstance given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionInstance + * @throws IOException if the JSON string is invalid with respect to PartRevisionInstance + */ + public static PartRevisionInstance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionInstance.class); + } + + /** + * Convert an instance of PartRevisionInstance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionInstanceData.java b/src/main/java/com/vertexvis/model/PartRevisionInstanceData.java new file mode 100644 index 0000000..6e7280d --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartRevisionInstanceData.java @@ -0,0 +1,308 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PartRevisionInstanceDataAttributes; +import com.vertexvis.model.PartRevisionInstanceDataRelationships; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PartRevisionInstanceData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartRevisionInstanceData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private PartRevisionInstanceDataAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull + private PartRevisionInstanceDataRelationships relationships; + + public PartRevisionInstanceData() { + } + + public PartRevisionInstanceData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public PartRevisionInstanceData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public PartRevisionInstanceData attributes(@javax.annotation.Nonnull PartRevisionInstanceDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public PartRevisionInstanceDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull PartRevisionInstanceDataAttributes attributes) { + this.attributes = attributes; + } + + + public PartRevisionInstanceData relationships(@javax.annotation.Nonnull PartRevisionInstanceDataRelationships relationships) { + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + */ + @javax.annotation.Nonnull + public PartRevisionInstanceDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(@javax.annotation.Nonnull PartRevisionInstanceDataRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartRevisionInstanceData partRevisionInstanceData = (PartRevisionInstanceData) o; + return Objects.equals(this.type, partRevisionInstanceData.type) && + Objects.equals(this.id, partRevisionInstanceData.id) && + Objects.equals(this.attributes, partRevisionInstanceData.attributes) && + Objects.equals(this.relationships, partRevisionInstanceData.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartRevisionInstanceData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionInstanceData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionInstanceData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionInstanceData is not found in the empty JSON string", PartRevisionInstanceData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionInstanceData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionInstanceData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionInstanceData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + PartRevisionInstanceDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + PartRevisionInstanceDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionInstanceData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionInstanceData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionInstanceData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionInstanceData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionInstanceData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionInstanceData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionInstanceData + * @throws IOException if the JSON string is invalid with respect to PartRevisionInstanceData + */ + public static PartRevisionInstanceData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionInstanceData.class); + } + + /** + * Convert an instance of PartRevisionInstanceData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartRevisionInstanceDataAttributes.java b/src/main/java/com/vertexvis/model/PartRevisionInstanceDataAttributes.java new file mode 100644 index 0000000..09edb38 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartRevisionInstanceDataAttributes.java @@ -0,0 +1,236 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Matrix4; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PartRevisionInstanceDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartRevisionInstanceDataAttributes { + public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; + @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nullable + private Integer ordinal; + + public static final String SERIALIZED_NAME_TRANSFORM = "transform"; + @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable + private Matrix4 transform; + + public PartRevisionInstanceDataAttributes() { + } + + public PartRevisionInstanceDataAttributes ordinal(@javax.annotation.Nullable Integer ordinal) { + this.ordinal = ordinal; + return this; + } + + /** + * A 0-based index used for defining a consistent ordering for children of an assembly + * minimum: 0 + * @return ordinal + */ + @javax.annotation.Nullable + public Integer getOrdinal() { + return ordinal; + } + + public void setOrdinal(@javax.annotation.Nullable Integer ordinal) { + this.ordinal = ordinal; + } + + + public PartRevisionInstanceDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { + this.transform = transform; + return this; + } + + /** + * Get transform + * @return transform + */ + @javax.annotation.Nullable + public Matrix4 getTransform() { + return transform; + } + + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { + this.transform = transform; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartRevisionInstanceDataAttributes partRevisionInstanceDataAttributes = (PartRevisionInstanceDataAttributes) o; + return Objects.equals(this.ordinal, partRevisionInstanceDataAttributes.ordinal) && + Objects.equals(this.transform, partRevisionInstanceDataAttributes.transform); + } + + @Override + public int hashCode() { + return Objects.hash(ordinal, transform); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartRevisionInstanceDataAttributes {\n"); + sb.append(" ordinal: ").append(toIndentedString(ordinal)).append("\n"); + sb.append(" transform: ").append(toIndentedString(transform)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ordinal"); + openapiFields.add("transform"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionInstanceDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionInstanceDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionInstanceDataAttributes is not found in the empty JSON string", PartRevisionInstanceDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionInstanceDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionInstanceDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionInstanceDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionInstanceDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionInstanceDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionInstanceDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionInstanceDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionInstanceDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionInstanceDataAttributes + * @throws IOException if the JSON string is invalid with respect to PartRevisionInstanceDataAttributes + */ + public static PartRevisionInstanceDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionInstanceDataAttributes.class); + } + + /** + * Convert an instance of PartRevisionInstanceDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartRevisionInstanceDataRelationships.java b/src/main/java/com/vertexvis/model/PartRevisionInstanceDataRelationships.java new file mode 100644 index 0000000..d3fd19b --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartRevisionInstanceDataRelationships.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PartRevisionRelationship; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * This is the relationship from the instance to the parent revision + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartRevisionInstanceDataRelationships { + public static final String SERIALIZED_NAME_PART_REVISION = "partRevision"; + @SerializedName(SERIALIZED_NAME_PART_REVISION) + @javax.annotation.Nonnull + private PartRevisionRelationship partRevision; + + public PartRevisionInstanceDataRelationships() { + } + + public PartRevisionInstanceDataRelationships partRevision(@javax.annotation.Nonnull PartRevisionRelationship partRevision) { + this.partRevision = partRevision; + return this; + } + + /** + * Get partRevision + * @return partRevision + */ + @javax.annotation.Nonnull + public PartRevisionRelationship getPartRevision() { + return partRevision; + } + + public void setPartRevision(@javax.annotation.Nonnull PartRevisionRelationship partRevision) { + this.partRevision = partRevision; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartRevisionInstanceDataRelationships partRevisionInstanceDataRelationships = (PartRevisionInstanceDataRelationships) o; + return Objects.equals(this.partRevision, partRevisionInstanceDataRelationships.partRevision); + } + + @Override + public int hashCode() { + return Objects.hash(partRevision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartRevisionInstanceDataRelationships {\n"); + sb.append(" partRevision: ").append(toIndentedString(partRevision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("partRevision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("partRevision"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionInstanceDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionInstanceDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionInstanceDataRelationships is not found in the empty JSON string", PartRevisionInstanceDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionInstanceDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionInstanceDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionInstanceDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `partRevision` + PartRevisionRelationship.validateJsonElement(jsonObj.get("partRevision")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionInstanceDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionInstanceDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionInstanceDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionInstanceDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionInstanceDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionInstanceDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionInstanceDataRelationships + * @throws IOException if the JSON string is invalid with respect to PartRevisionInstanceDataRelationships + */ + public static PartRevisionInstanceDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionInstanceDataRelationships.class); + } + + /** + * Convert an instance of PartRevisionInstanceDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartRevisionInstanceList.java b/src/main/java/com/vertexvis/model/PartRevisionInstanceList.java new file mode 100644 index 0000000..42af29c --- /dev/null +++ b/src/main/java/com/vertexvis/model/PartRevisionInstanceList.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.PartRevisionInstanceData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PartRevisionInstanceList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PartRevisionInstanceList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private Map links = new HashMap<>(); + + public PartRevisionInstanceList() { + } + + public PartRevisionInstanceList data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public PartRevisionInstanceList addDataItem(PartRevisionInstanceData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public PartRevisionInstanceList links(@javax.annotation.Nonnull Map links) { + this.links = links; + return this; + } + + public PartRevisionInstanceList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartRevisionInstanceList partRevisionInstanceList = (PartRevisionInstanceList) o; + return Objects.equals(this.data, partRevisionInstanceList.data) && + Objects.equals(this.links, partRevisionInstanceList.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartRevisionInstanceList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionInstanceList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionInstanceList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionInstanceList is not found in the empty JSON string", PartRevisionInstanceList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionInstanceList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionInstanceList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionInstanceList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PartRevisionInstanceData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionInstanceList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionInstanceList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionInstanceList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionInstanceList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionInstanceList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionInstanceList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionInstanceList + * @throws IOException if the JSON string is invalid with respect to PartRevisionInstanceList + */ + public static PartRevisionInstanceList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionInstanceList.class); + } + + /** + * Convert an instance of PartRevisionInstanceList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PartRevisionList.java b/src/main/java/com/vertexvis/model/PartRevisionList.java index 5e8d6a5..1d4906b 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionList.java +++ b/src/main/java/com/vertexvis/model/PartRevisionList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.PartRevisionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRevisionList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public PartRevisionList() { + public PartRevisionList() { } - public PartRevisionList data(List data) { - + public PartRevisionList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public PartRevisionList addDataItem(PartRevisionData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public PartRevisionList links(Map links) { - + public PartRevisionList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public PartRevisionList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionList is not found in the empty JSON string", PartRevisionList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PartRevisionData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionList + * @throws IOException if the JSON string is invalid with respect to PartRevisionList + */ + public static PartRevisionList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionList.class); + } + + /** + * Convert an instance of PartRevisionList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionRelationship.java b/src/main/java/com/vertexvis/model/PartRevisionRelationship.java index 36181fb..2538338 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionRelationship.java +++ b/src/main/java/com/vertexvis/model/PartRevisionRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PartDataRelationshipsPartRevisions; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `part-revision`. */ -@ApiModel(description = "Relationship to a `part-revision`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private PartDataRelationshipsPartRevisions data; - public PartRevisionRelationship() { + public PartRevisionRelationship() { } - public PartRevisionRelationship data(PartDataRelationshipsPartRevisions data) { - + public PartRevisionRelationship data(@javax.annotation.Nonnull PartDataRelationshipsPartRevisions data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public PartDataRelationshipsPartRevisions getData() { return data; } - - public void setData(PartDataRelationshipsPartRevisions data) { + public void setData(@javax.annotation.Nonnull PartDataRelationshipsPartRevisions data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionRelationship is not found in the empty JSON string", PartRevisionRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PartDataRelationshipsPartRevisions.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionRelationship + * @throws IOException if the JSON string is invalid with respect to PartRevisionRelationship + */ + public static PartRevisionRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionRelationship.class); + } + + /** + * Convert an instance of PartRevisionRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PartRevisionSuppliedId.java b/src/main/java/com/vertexvis/model/PartRevisionSuppliedId.java index 7e1d015..6a8dc50 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionSuppliedId.java +++ b/src/main/java/com/vertexvis/model/PartRevisionSuppliedId.java @@ -14,78 +14,118 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * PartRevisionSuppliedId */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PartRevisionSuppliedId { public static final String SERIALIZED_NAME_SUPPLIED_PART_ID = "suppliedPartId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_PART_ID) + @javax.annotation.Nonnull private String suppliedPartId; public static final String SERIALIZED_NAME_SUPPLIED_REVISION_ID = "suppliedRevisionId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_REVISION_ID) + @javax.annotation.Nonnull private String suppliedRevisionId; - public PartRevisionSuppliedId() { + public static final String SERIALIZED_NAME_SUPPLIED_ITERATION_ID = "suppliedIterationId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ITERATION_ID) + @javax.annotation.Nullable + private String suppliedIterationId; + + public PartRevisionSuppliedId() { } - public PartRevisionSuppliedId suppliedPartId(String suppliedPartId) { - + public PartRevisionSuppliedId suppliedPartId(@javax.annotation.Nonnull String suppliedPartId) { this.suppliedPartId = suppliedPartId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedPartId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedPartId() { return suppliedPartId; } - - public void setSuppliedPartId(String suppliedPartId) { + public void setSuppliedPartId(@javax.annotation.Nonnull String suppliedPartId) { this.suppliedPartId = suppliedPartId; } - public PartRevisionSuppliedId suppliedRevisionId(String suppliedRevisionId) { - + public PartRevisionSuppliedId suppliedRevisionId(@javax.annotation.Nonnull String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedRevisionId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedRevisionId() { return suppliedRevisionId; } - - public void setSuppliedRevisionId(String suppliedRevisionId) { + public void setSuppliedRevisionId(@javax.annotation.Nonnull String suppliedRevisionId) { this.suppliedRevisionId = suppliedRevisionId; } + public PartRevisionSuppliedId suppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + return this; + } + + /** + * Optional iteration ID for the revision. For example, a generated version id from a PLM system to a specific revision. Used when a existing revision is modified. + * @return suppliedIterationId + */ + @javax.annotation.Nullable + public String getSuppliedIterationId() { + return suppliedIterationId; + } + + public void setSuppliedIterationId(@javax.annotation.Nullable String suppliedIterationId) { + this.suppliedIterationId = suppliedIterationId; + } + + + @Override public boolean equals(Object o) { if (this == o) { @@ -96,12 +136,13 @@ public boolean equals(Object o) { } PartRevisionSuppliedId partRevisionSuppliedId = (PartRevisionSuppliedId) o; return Objects.equals(this.suppliedPartId, partRevisionSuppliedId.suppliedPartId) && - Objects.equals(this.suppliedRevisionId, partRevisionSuppliedId.suppliedRevisionId); + Objects.equals(this.suppliedRevisionId, partRevisionSuppliedId.suppliedRevisionId) && + Objects.equals(this.suppliedIterationId, partRevisionSuppliedId.suppliedIterationId); } @Override public int hashCode() { - return Objects.hash(suppliedPartId, suppliedRevisionId); + return Objects.hash(suppliedPartId, suppliedRevisionId, suppliedIterationId); } @Override @@ -110,6 +151,7 @@ public String toString() { sb.append("class PartRevisionSuppliedId {\n"); sb.append(" suppliedPartId: ").append(toIndentedString(suppliedPartId)).append("\n"); sb.append(" suppliedRevisionId: ").append(toIndentedString(suppliedRevisionId)).append("\n"); + sb.append(" suppliedIterationId: ").append(toIndentedString(suppliedIterationId)).append("\n"); sb.append("}"); return sb.toString(); } @@ -125,5 +167,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("suppliedPartId"); + openapiFields.add("suppliedRevisionId"); + openapiFields.add("suppliedIterationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("suppliedPartId"); + openapiRequiredFields.add("suppliedRevisionId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PartRevisionSuppliedId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartRevisionSuppliedId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartRevisionSuppliedId is not found in the empty JSON string", PartRevisionSuppliedId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PartRevisionSuppliedId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartRevisionSuppliedId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PartRevisionSuppliedId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("suppliedPartId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedPartId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedPartId").toString())); + } + if (!jsonObj.get("suppliedRevisionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedRevisionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedRevisionId").toString())); + } + if ((jsonObj.get("suppliedIterationId") != null && !jsonObj.get("suppliedIterationId").isJsonNull()) && !jsonObj.get("suppliedIterationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedIterationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedIterationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartRevisionSuppliedId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartRevisionSuppliedId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionSuppliedId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartRevisionSuppliedId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PartRevisionSuppliedId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartRevisionSuppliedId given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartRevisionSuppliedId + * @throws IOException if the JSON string is invalid with respect to PartRevisionSuppliedId + */ + public static PartRevisionSuppliedId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartRevisionSuppliedId.class); + } + + /** + * Convert an instance of PartRevisionSuppliedId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PerspectiveCamera.java b/src/main/java/com/vertexvis/model/PerspectiveCamera.java index d59f4e0..369403b 100644 --- a/src/main/java/com/vertexvis/model/PerspectiveCamera.java +++ b/src/main/java/com/vertexvis/model/PerspectiveCamera.java @@ -14,164 +14,170 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * A camera type that mimics the way the human eye sees. */ -@ApiModel(description = "A camera type that mimics the way the human eye sees.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class PerspectiveCamera { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; public static final String SERIALIZED_NAME_POSITION = "position"; @SerializedName(SERIALIZED_NAME_POSITION) + @javax.annotation.Nonnull private Vector3 position; public static final String SERIALIZED_NAME_LOOK_AT = "lookAt"; @SerializedName(SERIALIZED_NAME_LOOK_AT) + @javax.annotation.Nonnull private Vector3 lookAt; public static final String SERIALIZED_NAME_UP = "up"; @SerializedName(SERIALIZED_NAME_UP) + @javax.annotation.Nonnull private Vector3 up; public static final String SERIALIZED_NAME_FOV_Y = "fovY"; @SerializedName(SERIALIZED_NAME_FOV_Y) + @javax.annotation.Nullable private BigDecimal fovY; - public PerspectiveCamera() { + public PerspectiveCamera() { } - public PerspectiveCamera type(String type) { - + public PerspectiveCamera type(@javax.annotation.Nullable String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "perspective", value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nullable String type) { this.type = type; } - public PerspectiveCamera position(Vector3 position) { - + public PerspectiveCamera position(@javax.annotation.Nonnull Vector3 position) { this.position = position; return this; } - /** + /** * Get position * @return position - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getPosition() { return position; } - - public void setPosition(Vector3 position) { + public void setPosition(@javax.annotation.Nonnull Vector3 position) { this.position = position; } - public PerspectiveCamera lookAt(Vector3 lookAt) { - + public PerspectiveCamera lookAt(@javax.annotation.Nonnull Vector3 lookAt) { this.lookAt = lookAt; return this; } - /** + /** * Get lookAt * @return lookAt - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getLookAt() { return lookAt; } - - public void setLookAt(Vector3 lookAt) { + public void setLookAt(@javax.annotation.Nonnull Vector3 lookAt) { this.lookAt = lookAt; } - public PerspectiveCamera up(Vector3 up) { - + public PerspectiveCamera up(@javax.annotation.Nonnull Vector3 up) { this.up = up; return this; } - /** + /** * Get up * @return up - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getUp() { return up; } - - public void setUp(Vector3 up) { + public void setUp(@javax.annotation.Nonnull Vector3 up) { this.up = up; } - public PerspectiveCamera fovY(BigDecimal fovY) { - + public PerspectiveCamera fovY(@javax.annotation.Nullable BigDecimal fovY) { this.fovY = fovY; return this; } - /** + /** * A numerical floating-point value representing the field of view * minimum: 1 * maximum: 179 * @return fovY - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A numerical floating-point value representing the field of view") - public BigDecimal getFovY() { return fovY; } - - public void setFovY(BigDecimal fovY) { + public void setFovY(@javax.annotation.Nullable BigDecimal fovY) { this.fovY = fovY; } + @Override public boolean equals(Object o) { if (this == o) { @@ -217,5 +223,112 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("position"); + openapiFields.add("lookAt"); + openapiFields.add("up"); + openapiFields.add("fovY"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("position"); + openapiRequiredFields.add("lookAt"); + openapiRequiredFields.add("up"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PerspectiveCamera + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PerspectiveCamera.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PerspectiveCamera is not found in the empty JSON string", PerspectiveCamera.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PerspectiveCamera.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PerspectiveCamera` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PerspectiveCamera.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `position` + Vector3.validateJsonElement(jsonObj.get("position")); + // validate the required field `lookAt` + Vector3.validateJsonElement(jsonObj.get("lookAt")); + // validate the required field `up` + Vector3.validateJsonElement(jsonObj.get("up")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PerspectiveCamera.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PerspectiveCamera' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PerspectiveCamera.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PerspectiveCamera value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PerspectiveCamera read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PerspectiveCamera given an JSON string + * + * @param jsonString JSON string + * @return An instance of PerspectiveCamera + * @throws IOException if the JSON string is invalid with respect to PerspectiveCamera + */ + public static PerspectiveCamera fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PerspectiveCamera.class); + } + + /** + * Convert an instance of PerspectiveCamera to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PmiAnnotationData.java b/src/main/java/com/vertexvis/model/PmiAnnotationData.java new file mode 100644 index 0000000..0a41a3c --- /dev/null +++ b/src/main/java/com/vertexvis/model/PmiAnnotationData.java @@ -0,0 +1,315 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateAccountRequestDataAttributes; +import com.vertexvis.model.Link; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PmiAnnotationData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PmiAnnotationData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private CreateAccountRequestDataAttributes attributes; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public PmiAnnotationData() { + } + + public PmiAnnotationData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public PmiAnnotationData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public PmiAnnotationData attributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public CreateAccountRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + public PmiAnnotationData links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public PmiAnnotationData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PmiAnnotationData pmiAnnotationData = (PmiAnnotationData) o; + return Objects.equals(this.type, pmiAnnotationData.type) && + Objects.equals(this.id, pmiAnnotationData.id) && + Objects.equals(this.attributes, pmiAnnotationData.attributes) && + Objects.equals(this.links, pmiAnnotationData.links); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PmiAnnotationData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PmiAnnotationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PmiAnnotationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PmiAnnotationData is not found in the empty JSON string", PmiAnnotationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PmiAnnotationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PmiAnnotationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PmiAnnotationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + CreateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PmiAnnotationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PmiAnnotationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PmiAnnotationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PmiAnnotationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PmiAnnotationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PmiAnnotationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PmiAnnotationData + * @throws IOException if the JSON string is invalid with respect to PmiAnnotationData + */ + public static PmiAnnotationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PmiAnnotationData.class); + } + + /** + * Convert an instance of PmiAnnotationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PmiAnnotationList.java b/src/main/java/com/vertexvis/model/PmiAnnotationList.java new file mode 100644 index 0000000..0bdb3f6 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PmiAnnotationList.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.PmiAnnotationData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PmiAnnotationList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PmiAnnotationList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private Map links = new HashMap<>(); + + public PmiAnnotationList() { + } + + public PmiAnnotationList data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public PmiAnnotationList addDataItem(PmiAnnotationData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public PmiAnnotationList links(@javax.annotation.Nonnull Map links) { + this.links = links; + return this; + } + + public PmiAnnotationList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PmiAnnotationList pmiAnnotationList = (PmiAnnotationList) o; + return Objects.equals(this.data, pmiAnnotationList.data) && + Objects.equals(this.links, pmiAnnotationList.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PmiAnnotationList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PmiAnnotationList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PmiAnnotationList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PmiAnnotationList is not found in the empty JSON string", PmiAnnotationList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PmiAnnotationList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PmiAnnotationList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PmiAnnotationList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PmiAnnotationData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PmiAnnotationList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PmiAnnotationList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PmiAnnotationList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PmiAnnotationList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PmiAnnotationList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PmiAnnotationList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PmiAnnotationList + * @throws IOException if the JSON string is invalid with respect to PmiAnnotationList + */ + public static PmiAnnotationList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PmiAnnotationList.class); + } + + /** + * Convert an instance of PmiAnnotationList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/Point.java b/src/main/java/com/vertexvis/model/Point.java index 2ec5141..f4039f0 100644 --- a/src/main/java/com/vertexvis/model/Point.java +++ b/src/main/java/com/vertexvis/model/Point.java @@ -14,79 +14,94 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * 2D point. */ -@ApiModel(description = "2D point.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Point { public static final String SERIALIZED_NAME_DX = "dx"; @SerializedName(SERIALIZED_NAME_DX) + @javax.annotation.Nonnull private Integer dx; public static final String SERIALIZED_NAME_DY = "dy"; @SerializedName(SERIALIZED_NAME_DY) + @javax.annotation.Nonnull private Integer dy; - public Point() { + public Point() { } - public Point dx(Integer dx) { - + public Point dx(@javax.annotation.Nonnull Integer dx) { this.dx = dx; return this; } - /** + /** * x-axis coordinate. * @return dx - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0", required = true, value = "x-axis coordinate.") - public Integer getDx() { return dx; } - - public void setDx(Integer dx) { + public void setDx(@javax.annotation.Nonnull Integer dx) { this.dx = dx; } - public Point dy(Integer dy) { - + public Point dy(@javax.annotation.Nonnull Integer dy) { this.dy = dy; return this; } - /** + /** * y-axis coordinate. * @return dy - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0", required = true, value = "y-axis coordinate.") - public Integer getDy() { return dy; } - - public void setDy(Integer dy) { + public void setDy(@javax.annotation.Nonnull Integer dy) { this.dy = dy; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +141,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dx"); + openapiFields.add("dy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dx"); + openapiRequiredFields.add("dy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Point + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Point.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Point is not found in the empty JSON string", Point.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Point.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Point` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Point.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Point.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Point' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Point.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Point value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Point read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Point given an JSON string + * + * @param jsonString JSON string + * @return An instance of Point + * @throws IOException if the JSON string is invalid with respect to Point + */ + public static Point fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Point.class); + } + + /** + * Convert an instance of Point to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/PropertyDateType.java b/src/main/java/com/vertexvis/model/PropertyDateType.java new file mode 100644 index 0000000..7b379bd --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyDateType.java @@ -0,0 +1,295 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyDateType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyDateType { + /** + * Type of property value. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DATE("date"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private OffsetDateTime value; + + public PropertyDateType() { + } + + public PropertyDateType type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of property value. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PropertyDateType value(@javax.annotation.Nonnull OffsetDateTime value) { + this.value = value; + return this; + } + + /** + * A date value. + * @return value + */ + @javax.annotation.Nonnull + public OffsetDateTime getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull OffsetDateTime value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyDateType propertyDateType = (PropertyDateType) o; + return Objects.equals(this.type, propertyDateType.type) && + Objects.equals(this.value, propertyDateType.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyDateType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyDateType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyDateType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyDateType is not found in the empty JSON string", PropertyDateType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyDateType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyDateType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyDateType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyDateType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyDateType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyDateType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyDateType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyDateType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyDateType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyDateType + * @throws IOException if the JSON string is invalid with respect to PropertyDateType + */ + public static PropertyDateType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyDateType.class); + } + + /** + * Convert an instance of PropertyDateType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyDoubleType.java b/src/main/java/com/vertexvis/model/PropertyDoubleType.java new file mode 100644 index 0000000..067c44d --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyDoubleType.java @@ -0,0 +1,294 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyDoubleType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyDoubleType { + /** + * Type of property value. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DOUBLE("double"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private Double value; + + public PropertyDoubleType() { + } + + public PropertyDoubleType type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of property value. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PropertyDoubleType value(@javax.annotation.Nonnull Double value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public Double getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull Double value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyDoubleType propertyDoubleType = (PropertyDoubleType) o; + return Objects.equals(this.type, propertyDoubleType.type) && + Objects.equals(this.value, propertyDoubleType.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyDoubleType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyDoubleType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyDoubleType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyDoubleType is not found in the empty JSON string", PropertyDoubleType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyDoubleType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyDoubleType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyDoubleType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyDoubleType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyDoubleType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyDoubleType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyDoubleType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyDoubleType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyDoubleType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyDoubleType + * @throws IOException if the JSON string is invalid with respect to PropertyDoubleType + */ + public static PropertyDoubleType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyDoubleType.class); + } + + /** + * Convert an instance of PropertyDoubleType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyEntryData.java b/src/main/java/com/vertexvis/model/PropertyEntryData.java new file mode 100644 index 0000000..6938cb2 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyEntryData.java @@ -0,0 +1,314 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.PropertyEntryDataAttributes; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyEntryData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyEntryData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private PropertyEntryDataAttributes attributes; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public PropertyEntryData() { + } + + public PropertyEntryData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public PropertyEntryData id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public PropertyEntryData attributes(@javax.annotation.Nonnull PropertyEntryDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public PropertyEntryDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull PropertyEntryDataAttributes attributes) { + this.attributes = attributes; + } + + + public PropertyEntryData links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public PropertyEntryData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyEntryData propertyEntryData = (PropertyEntryData) o; + return Objects.equals(this.type, propertyEntryData.type) && + Objects.equals(this.id, propertyEntryData.id) && + Objects.equals(this.attributes, propertyEntryData.attributes) && + Objects.equals(this.links, propertyEntryData.links); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyEntryData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyEntryData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyEntryData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyEntryData is not found in the empty JSON string", PropertyEntryData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyEntryData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyEntryData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyEntryData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + PropertyEntryDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyEntryData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyEntryData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyEntryData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyEntryData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyEntryData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyEntryData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyEntryData + * @throws IOException if the JSON string is invalid with respect to PropertyEntryData + */ + public static PropertyEntryData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyEntryData.class); + } + + /** + * Convert an instance of PropertyEntryData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java new file mode 100644 index 0000000..4519d66 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java @@ -0,0 +1,245 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PropertyEntryDataAttributesValue; +import com.vertexvis.model.PropertyKeyType; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyEntryDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyEntryDataAttributes { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private PropertyEntryDataAttributesValue value; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nonnull + private PropertyKeyType key; + + public PropertyEntryDataAttributes() { + } + + public PropertyEntryDataAttributes value(@javax.annotation.Nonnull PropertyEntryDataAttributesValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public PropertyEntryDataAttributesValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull PropertyEntryDataAttributesValue value) { + this.value = value; + } + + + public PropertyEntryDataAttributes key(@javax.annotation.Nonnull PropertyKeyType key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @javax.annotation.Nonnull + public PropertyKeyType getKey() { + return key; + } + + public void setKey(@javax.annotation.Nonnull PropertyKeyType key) { + this.key = key; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyEntryDataAttributes propertyEntryDataAttributes = (PropertyEntryDataAttributes) o; + return Objects.equals(this.value, propertyEntryDataAttributes.value) && + Objects.equals(this.key, propertyEntryDataAttributes.key); + } + + @Override + public int hashCode() { + return Objects.hash(value, key); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyEntryDataAttributes {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("key"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("key"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyEntryDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyEntryDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyEntryDataAttributes is not found in the empty JSON string", PropertyEntryDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyEntryDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyEntryDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyEntryDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `value` + PropertyEntryDataAttributesValue.validateJsonElement(jsonObj.get("value")); + // validate the required field `key` + PropertyKeyType.validateJsonElement(jsonObj.get("key")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyEntryDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyEntryDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyEntryDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyEntryDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyEntryDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyEntryDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyEntryDataAttributes + * @throws IOException if the JSON string is invalid with respect to PropertyEntryDataAttributes + */ + public static PropertyEntryDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyEntryDataAttributes.class); + } + + /** + * Convert an instance of PropertyEntryDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java new file mode 100644 index 0000000..9144f1b --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java @@ -0,0 +1,360 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PropertyDateType; +import com.vertexvis.model.PropertyDoubleType; +import com.vertexvis.model.PropertyLongType; +import com.vertexvis.model.PropertyStringType; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyEntryDataAttributesValue extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(PropertyEntryDataAttributesValue.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyEntryDataAttributesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyEntryDataAttributesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPropertyStringType = gson.getDelegateAdapter(this, TypeToken.get(PropertyStringType.class)); + final TypeAdapter adapterPropertyDoubleType = gson.getDelegateAdapter(this, TypeToken.get(PropertyDoubleType.class)); + final TypeAdapter adapterPropertyLongType = gson.getDelegateAdapter(this, TypeToken.get(PropertyLongType.class)); + final TypeAdapter adapterPropertyDateType = gson.getDelegateAdapter(this, TypeToken.get(PropertyDateType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyEntryDataAttributesValue value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PropertyStringType` + if (value.getActualInstance() instanceof PropertyStringType) { + JsonElement element = adapterPropertyStringType.toJsonTree((PropertyStringType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyDoubleType` + if (value.getActualInstance() instanceof PropertyDoubleType) { + JsonElement element = adapterPropertyDoubleType.toJsonTree((PropertyDoubleType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyLongType` + if (value.getActualInstance() instanceof PropertyLongType) { + JsonElement element = adapterPropertyLongType.toJsonTree((PropertyLongType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyDateType` + if (value.getActualInstance() instanceof PropertyDateType) { + JsonElement element = adapterPropertyDateType.toJsonTree((PropertyDateType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType"); + } + + @Override + public PropertyEntryDataAttributesValue read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PropertyStringType + try { + // validate the JSON object to see if any exception is thrown + PropertyStringType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyStringType; + PropertyEntryDataAttributesValue ret = new PropertyEntryDataAttributesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyStringType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyStringType'", e); + } + // deserialize PropertyDoubleType + try { + // validate the JSON object to see if any exception is thrown + PropertyDoubleType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyDoubleType; + PropertyEntryDataAttributesValue ret = new PropertyEntryDataAttributesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyDoubleType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyDoubleType'", e); + } + // deserialize PropertyLongType + try { + // validate the JSON object to see if any exception is thrown + PropertyLongType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyLongType; + PropertyEntryDataAttributesValue ret = new PropertyEntryDataAttributesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyLongType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyLongType'", e); + } + // deserialize PropertyDateType + try { + // validate the JSON object to see if any exception is thrown + PropertyDateType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyDateType; + PropertyEntryDataAttributesValue ret = new PropertyEntryDataAttributesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyDateType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyDateType'", e); + } + + throw new IOException(String.format("Failed deserialization for PropertyEntryDataAttributesValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public PropertyEntryDataAttributesValue() { + super("anyOf", Boolean.FALSE); + } + + public PropertyEntryDataAttributesValue(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PropertyStringType", PropertyStringType.class); + schemas.put("PropertyDoubleType", PropertyDoubleType.class); + schemas.put("PropertyLongType", PropertyLongType.class); + schemas.put("PropertyDateType", PropertyDateType.class); + } + + @Override + public Map> getSchemas() { + return PropertyEntryDataAttributesValue.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PropertyStringType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyDoubleType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyLongType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyDateType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType"); + } + + /** + * Get the actual instance, which can be the following: + * PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType + * + * @return The actual instance (PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyStringType`. If the actual instance is not `PropertyStringType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyStringType` + * @throws ClassCastException if the instance is not `PropertyStringType` + */ + public PropertyStringType getPropertyStringType() throws ClassCastException { + return (PropertyStringType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyDoubleType`. If the actual instance is not `PropertyDoubleType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyDoubleType` + * @throws ClassCastException if the instance is not `PropertyDoubleType` + */ + public PropertyDoubleType getPropertyDoubleType() throws ClassCastException { + return (PropertyDoubleType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyLongType`. If the actual instance is not `PropertyLongType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyLongType` + * @throws ClassCastException if the instance is not `PropertyLongType` + */ + public PropertyLongType getPropertyLongType() throws ClassCastException { + return (PropertyLongType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyDateType`. If the actual instance is not `PropertyDateType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyDateType` + * @throws ClassCastException if the instance is not `PropertyDateType` + */ + public PropertyDateType getPropertyDateType() throws ClassCastException { + return (PropertyDateType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyEntryDataAttributesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PropertyStringType + try { + PropertyStringType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyStringType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyDoubleType + try { + PropertyDoubleType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyDoubleType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyLongType + try { + PropertyLongType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyLongType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyDateType + try { + PropertyDateType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyDateType failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for PropertyEntryDataAttributesValue with anyOf schemas: PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of PropertyEntryDataAttributesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyEntryDataAttributesValue + * @throws IOException if the JSON string is invalid with respect to PropertyEntryDataAttributesValue + */ + public static PropertyEntryDataAttributesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyEntryDataAttributesValue.class); + } + + /** + * Convert an instance of PropertyEntryDataAttributesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyEntryList.java b/src/main/java/com/vertexvis/model/PropertyEntryList.java new file mode 100644 index 0000000..50b9e1b --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyEntryList.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.PropertyEntryData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyEntryList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyEntryList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private Map links = new HashMap<>(); + + public PropertyEntryList() { + } + + public PropertyEntryList data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public PropertyEntryList addDataItem(PropertyEntryData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public PropertyEntryList links(@javax.annotation.Nonnull Map links) { + this.links = links; + return this; + } + + public PropertyEntryList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyEntryList propertyEntryList = (PropertyEntryList) o; + return Objects.equals(this.data, propertyEntryList.data) && + Objects.equals(this.links, propertyEntryList.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyEntryList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyEntryList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyEntryList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyEntryList is not found in the empty JSON string", PropertyEntryList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyEntryList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyEntryList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyEntryList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PropertyEntryData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyEntryList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyEntryList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyEntryList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyEntryList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyEntryList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyEntryList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyEntryList + * @throws IOException if the JSON string is invalid with respect to PropertyEntryList + */ + public static PropertyEntryList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyEntryList.class); + } + + /** + * Convert an instance of PropertyEntryList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyKeyType.java b/src/main/java/com/vertexvis/model/PropertyKeyType.java new file mode 100644 index 0000000..2f96b79 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyKeyType.java @@ -0,0 +1,301 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyKeyType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyKeyType { + /** + * The key category + */ + @JsonAdapter(CategoryEnum.Adapter.class) + public enum CategoryEnum { + VENDOR("vendor"), + + VERTEX("vertex"), + + USER("user"); + + private String value; + + CategoryEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CategoryEnum fromValue(String value) { + for (CategoryEnum b : CategoryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CategoryEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CategoryEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CategoryEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CategoryEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryEnum category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public PropertyKeyType() { + } + + public PropertyKeyType category(@javax.annotation.Nonnull CategoryEnum category) { + this.category = category; + return this; + } + + /** + * The key category + * @return category + */ + @javax.annotation.Nonnull + public CategoryEnum getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryEnum category) { + this.category = category; + } + + + public PropertyKeyType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyKeyType propertyKeyType = (PropertyKeyType) o; + return Objects.equals(this.category, propertyKeyType.category) && + Objects.equals(this.name, propertyKeyType.name); + } + + @Override + public int hashCode() { + return Objects.hash(category, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyKeyType {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("category"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyKeyType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyKeyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyKeyType is not found in the empty JSON string", PropertyKeyType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyKeyType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyKeyType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyKeyType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("category").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("category").toString())); + } + // validate the required field `category` + CategoryEnum.validateJsonElement(jsonObj.get("category")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyKeyType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyKeyType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyKeyType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyKeyType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyKeyType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyKeyType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyKeyType + * @throws IOException if the JSON string is invalid with respect to PropertyKeyType + */ + public static PropertyKeyType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyKeyType.class); + } + + /** + * Convert an instance of PropertyKeyType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyLongType.java b/src/main/java/com/vertexvis/model/PropertyLongType.java new file mode 100644 index 0000000..8dfa8d2 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyLongType.java @@ -0,0 +1,294 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyLongType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyLongType { + /** + * Type of property-entry value. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + LONG("long"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private Long value; + + public PropertyLongType() { + } + + public PropertyLongType type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of property-entry value. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PropertyLongType value(@javax.annotation.Nonnull Long value) { + this.value = value; + return this; + } + + /** + * A numerical long value. + * @return value + */ + @javax.annotation.Nonnull + public Long getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull Long value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyLongType propertyLongType = (PropertyLongType) o; + return Objects.equals(this.type, propertyLongType.type) && + Objects.equals(this.value, propertyLongType.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyLongType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyLongType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyLongType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyLongType is not found in the empty JSON string", PropertyLongType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyLongType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyLongType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyLongType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyLongType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyLongType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyLongType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyLongType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyLongType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyLongType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyLongType + * @throws IOException if the JSON string is invalid with respect to PropertyLongType + */ + public static PropertyLongType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyLongType.class); + } + + /** + * Convert an instance of PropertyLongType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertySetRelationship.java b/src/main/java/com/vertexvis/model/PropertySetRelationship.java new file mode 100644 index 0000000..71eeec8 --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertySetRelationship.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PropertySetRelationshipData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * Relationship to a `property-set`. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertySetRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private PropertySetRelationshipData data; + + public PropertySetRelationship() { + } + + public PropertySetRelationship data(@javax.annotation.Nonnull PropertySetRelationshipData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public PropertySetRelationshipData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull PropertySetRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertySetRelationship propertySetRelationship = (PropertySetRelationship) o; + return Objects.equals(this.data, propertySetRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertySetRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertySetRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertySetRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySetRelationship is not found in the empty JSON string", PropertySetRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertySetRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySetRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertySetRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PropertySetRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertySetRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertySetRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertySetRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertySetRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertySetRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertySetRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertySetRelationship + * @throws IOException if the JSON string is invalid with respect to PropertySetRelationship + */ + public static PropertySetRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertySetRelationship.class); + } + + /** + * Convert an instance of PropertySetRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertySetRelationshipData.java b/src/main/java/com/vertexvis/model/PropertySetRelationshipData.java new file mode 100644 index 0000000..dfabf7d --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertySetRelationshipData.java @@ -0,0 +1,298 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertySetRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertySetRelationshipData { + /** + * Resource object type. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PROPERTY_SET("property-set"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public PropertySetRelationshipData() { + } + + public PropertySetRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PropertySetRelationshipData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertySetRelationshipData propertySetRelationshipData = (PropertySetRelationshipData) o; + return Objects.equals(this.type, propertySetRelationshipData.type) && + Objects.equals(this.id, propertySetRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertySetRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertySetRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertySetRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySetRelationshipData is not found in the empty JSON string", PropertySetRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertySetRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySetRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertySetRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertySetRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertySetRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertySetRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertySetRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertySetRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertySetRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertySetRelationshipData + * @throws IOException if the JSON string is invalid with respect to PropertySetRelationshipData + */ + public static PropertySetRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertySetRelationshipData.class); + } + + /** + * Convert an instance of PropertySetRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/PropertyStringType.java b/src/main/java/com/vertexvis/model/PropertyStringType.java new file mode 100644 index 0000000..948341b --- /dev/null +++ b/src/main/java/com/vertexvis/model/PropertyStringType.java @@ -0,0 +1,297 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * PropertyStringType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PropertyStringType { + /** + * Type of property-entry value. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + STRING("string"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public PropertyStringType() { + } + + public PropertyStringType type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of property-entry value. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PropertyStringType value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * A string value. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PropertyStringType propertyStringType = (PropertyStringType) o; + return Objects.equals(this.type, propertyStringType.type) && + Objects.equals(this.value, propertyStringType.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyStringType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyStringType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyStringType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyStringType is not found in the empty JSON string", PropertyStringType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PropertyStringType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyStringType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PropertyStringType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyStringType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyStringType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyStringType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyStringType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PropertyStringType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyStringType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyStringType + * @throws IOException if the JSON string is invalid with respect to PropertyStringType + */ + public static PropertyStringType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyStringType.class); + } + + /** + * Convert an instance of PropertyStringType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/QueryAll.java b/src/main/java/com/vertexvis/model/QueryAll.java index f0b317f..a42faca 100644 --- a/src/main/java/com/vertexvis/model/QueryAll.java +++ b/src/main/java/com/vertexvis/model/QueryAll.java @@ -14,12 +14,11 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; -import io.swagger.annotations.ApiModel; import com.google.gson.annotations.SerializedName; import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; @@ -68,5 +67,10 @@ public QueryAll read(final JsonReader jsonReader) throws IOException { return QueryAll.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + QueryAll.fromValue(value); + } } diff --git a/src/main/java/com/vertexvis/model/QueryByCollection.java b/src/main/java/com/vertexvis/model/QueryByCollection.java index 1767906..076e2f2 100644 --- a/src/main/java/com/vertexvis/model/QueryByCollection.java +++ b/src/main/java/com/vertexvis/model/QueryByCollection.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.QueryByCollectionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * QueryByCollection */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryByCollection { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private QueryByCollectionData data; - public QueryByCollection() { + public QueryByCollection() { } - public QueryByCollection data(QueryByCollectionData data) { - + public QueryByCollection data(@javax.annotation.Nonnull QueryByCollectionData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueryByCollectionData getData() { return data; } - - public void setData(QueryByCollectionData data) { + public void setData(@javax.annotation.Nonnull QueryByCollectionData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryByCollection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryByCollection.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryByCollection is not found in the empty JSON string", QueryByCollection.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryByCollection.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryByCollection` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryByCollection.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + QueryByCollectionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryByCollection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryByCollection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryByCollection.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryByCollection value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryByCollection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryByCollection given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryByCollection + * @throws IOException if the JSON string is invalid with respect to QueryByCollection + */ + public static QueryByCollection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryByCollection.class); + } + + /** + * Convert an instance of QueryByCollection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueryByCollectionData.java b/src/main/java/com/vertexvis/model/QueryByCollectionData.java index f0484ea..2d24cf4 100644 --- a/src/main/java/com/vertexvis/model/QueryByCollectionData.java +++ b/src/main/java/com/vertexvis/model/QueryByCollectionData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.QueryByCollectionDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueryByCollectionData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryByCollectionData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private QueryByCollectionDataAttributes attributes; - public QueryByCollectionData() { + public QueryByCollectionData() { } - public QueryByCollectionData type(TypeEnum type) { - + public QueryByCollectionData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "query-by-collection", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public QueryByCollectionData attributes(QueryByCollectionDataAttributes attributes) { - + public QueryByCollectionData attributes(@javax.annotation.Nonnull QueryByCollectionDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueryByCollectionDataAttributes getAttributes() { return attributes; } - - public void setAttributes(QueryByCollectionDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull QueryByCollectionDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryByCollectionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryByCollectionData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryByCollectionData is not found in the empty JSON string", QueryByCollectionData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryByCollectionData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryByCollectionData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryByCollectionData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `attributes` + QueryByCollectionDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryByCollectionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryByCollectionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryByCollectionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryByCollectionData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryByCollectionData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryByCollectionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryByCollectionData + * @throws IOException if the JSON string is invalid with respect to QueryByCollectionData + */ + public static QueryByCollectionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryByCollectionData.class); + } + + /** + * Convert an instance of QueryByCollectionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueryByCollectionDataAttributes.java b/src/main/java/com/vertexvis/model/QueryByCollectionDataAttributes.java index b600f86..9d7e6e6 100644 --- a/src/main/java/com/vertexvis/model/QueryByCollectionDataAttributes.java +++ b/src/main/java/com/vertexvis/model/QueryByCollectionDataAttributes.java @@ -14,23 +14,44 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.QueryById; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueryByCollectionDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryByCollectionDataAttributes { /** * Resource object type. @@ -77,70 +98,73 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_VALUES = "values"; @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull private List values = new ArrayList<>(); - public QueryByCollectionDataAttributes() { + public QueryByCollectionDataAttributes() { } - public QueryByCollectionDataAttributes type(TypeEnum type) { - + public QueryByCollectionDataAttributes type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "and", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public QueryByCollectionDataAttributes values(List values) { - + public QueryByCollectionDataAttributes values(@javax.annotation.Nonnull List values) { this.values = values; return this; } public QueryByCollectionDataAttributes addValuesItem(QueryById valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } this.values.add(valuesItem); return this; } - /** + /** * Query `scene-items`. * @return values - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Query `scene-items`.") - public List getValues() { return values; } - - public void setValues(List values) { + public void setValues(@javax.annotation.Nonnull List values) { this.values = values; } + @Override public boolean equals(Object o) { if (this == o) { @@ -180,5 +204,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryByCollectionDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryByCollectionDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryByCollectionDataAttributes is not found in the empty JSON string", QueryByCollectionDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryByCollectionDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryByCollectionDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryByCollectionDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + QueryById.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryByCollectionDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryByCollectionDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryByCollectionDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryByCollectionDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryByCollectionDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryByCollectionDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryByCollectionDataAttributes + * @throws IOException if the JSON string is invalid with respect to QueryByCollectionDataAttributes + */ + public static QueryByCollectionDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryByCollectionDataAttributes.class); + } + + /** + * Convert an instance of QueryByCollectionDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueryById.java b/src/main/java/com/vertexvis/model/QueryById.java index 139743b..eadfe1b 100644 --- a/src/main/java/com/vertexvis/model/QueryById.java +++ b/src/main/java/com/vertexvis/model/QueryById.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.QueryByIdData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * QueryById */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryById { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private QueryByIdData data; - public QueryById() { + public QueryById() { } - public QueryById data(QueryByIdData data) { - + public QueryById data(@javax.annotation.Nonnull QueryByIdData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueryByIdData getData() { return data; } - - public void setData(QueryByIdData data) { + public void setData(@javax.annotation.Nonnull QueryByIdData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryById + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryById.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryById is not found in the empty JSON string", QueryById.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryById.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryById` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryById.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + QueryByIdData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryById.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryById' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryById.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryById value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryById read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryById given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryById + * @throws IOException if the JSON string is invalid with respect to QueryById + */ + public static QueryById fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryById.class); + } + + /** + * Convert an instance of QueryById to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueryByIdData.java b/src/main/java/com/vertexvis/model/QueryByIdData.java index a25e8af..dbdfdfc 100644 --- a/src/main/java/com/vertexvis/model/QueryByIdData.java +++ b/src/main/java/com/vertexvis/model/QueryByIdData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.QueryByIdDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueryByIdData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryByIdData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private QueryByIdDataAttributes attributes; - public QueryByIdData() { + public QueryByIdData() { } - public QueryByIdData type(TypeEnum type) { - + public QueryByIdData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "query-by-id", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public QueryByIdData attributes(QueryByIdDataAttributes attributes) { - + public QueryByIdData attributes(@javax.annotation.Nonnull QueryByIdDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueryByIdDataAttributes getAttributes() { return attributes; } - - public void setAttributes(QueryByIdDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull QueryByIdDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryByIdData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryByIdData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryByIdData is not found in the empty JSON string", QueryByIdData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryByIdData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryByIdData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryByIdData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `attributes` + QueryByIdDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryByIdData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryByIdData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryByIdData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryByIdData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryByIdData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryByIdData given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryByIdData + * @throws IOException if the JSON string is invalid with respect to QueryByIdData + */ + public static QueryByIdData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryByIdData.class); + } + + /** + * Convert an instance of QueryByIdData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueryByIdDataAttributes.java b/src/main/java/com/vertexvis/model/QueryByIdDataAttributes.java index b90a557..bea149e 100644 --- a/src/main/java/com/vertexvis/model/QueryByIdDataAttributes.java +++ b/src/main/java/com/vertexvis/model/QueryByIdDataAttributes.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueryByIdDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueryByIdDataAttributes { /** * Resource object type. @@ -36,7 +57,7 @@ public class QueryByIdDataAttributes { public enum TypeEnum { ID("id"), - SUPPLIEDID("suppliedId"); + SUPPLIED_ID("suppliedId"); private String value; @@ -74,65 +95,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull private String value; - public QueryByIdDataAttributes() { + public QueryByIdDataAttributes() { } - public QueryByIdDataAttributes type(TypeEnum type) { - + public QueryByIdDataAttributes type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "suppliedId", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public QueryByIdDataAttributes value(String value) { - + public QueryByIdDataAttributes value(@javax.annotation.Nonnull String value) { this.value = value; return this; } - /** + /** * ID of the resource. * @return value - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "ID of the resource.") - public String getValue() { return value; } - - public void setValue(String value) { + public void setValue(@javax.annotation.Nonnull String value) { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { @@ -172,5 +193,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryByIdDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryByIdDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryByIdDataAttributes is not found in the empty JSON string", QueryByIdDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryByIdDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryByIdDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryByIdDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryByIdDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryByIdDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryByIdDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryByIdDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryByIdDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueryByIdDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryByIdDataAttributes + * @throws IOException if the JSON string is invalid with respect to QueryByIdDataAttributes + */ + public static QueryByIdDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryByIdDataAttributes.class); + } + + /** + * Convert an instance of QueryByIdDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedJob.java b/src/main/java/com/vertexvis/model/QueuedJob.java index 137a477..a6aca50 100644 --- a/src/main/java/com/vertexvis/model/QueuedJob.java +++ b/src/main/java/com/vertexvis/model/QueuedJob.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.QueuedJobData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * QueuedJob */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedJob { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private QueuedJobData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public QueuedJob() { + public QueuedJob() { } - public QueuedJob data(QueuedJobData data) { - + public QueuedJob data(@javax.annotation.Nonnull QueuedJobData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueuedJobData getData() { return data; } - - public void setData(QueuedJobData data) { + public void setData(@javax.annotation.Nonnull QueuedJobData data) { this.data = data; } - public QueuedJob links(Map links) { - + public QueuedJob links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public QueuedJob putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedJob + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedJob.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedJob is not found in the empty JSON string", QueuedJob.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedJob.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedJob` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedJob.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + QueuedJobData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedJob.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedJob' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedJob.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedJob value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedJob read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedJob given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedJob + * @throws IOException if the JSON string is invalid with respect to QueuedJob + */ + public static QueuedJob fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedJob.class); + } + + /** + * Convert an instance of QueuedJob to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedJobData.java b/src/main/java/com/vertexvis/model/QueuedJobData.java index 95b0cde..54fc681 100644 --- a/src/main/java/com/vertexvis/model/QueuedJobData.java +++ b/src/main/java/com/vertexvis/model/QueuedJobData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.QueuedJobDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueuedJobData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedJobData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private QueuedJobDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public QueuedJobData() { + public QueuedJobData() { } - public QueuedJobData type(String type) { - + public QueuedJobData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public QueuedJobData id(UUID id) { - + public QueuedJobData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public QueuedJobData attributes(QueuedJobDataAttributes attributes) { - + public QueuedJobData attributes(@javax.annotation.Nonnull QueuedJobDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueuedJobDataAttributes getAttributes() { return attributes; } - - public void setAttributes(QueuedJobDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull QueuedJobDataAttributes attributes) { this.attributes = attributes; } - public QueuedJobData links(Map links) { - + public QueuedJobData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public QueuedJobData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedJobData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedJobData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedJobData is not found in the empty JSON string", QueuedJobData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedJobData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedJobData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedJobData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + QueuedJobDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedJobData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedJobData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedJobData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedJobData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedJobData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedJobData given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedJobData + * @throws IOException if the JSON string is invalid with respect to QueuedJobData + */ + public static QueuedJobData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedJobData.class); + } + + /** + * Convert an instance of QueuedJobData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedJobDataAttributes.java b/src/main/java/com/vertexvis/model/QueuedJobDataAttributes.java index 7f35d3a..bb01472 100644 --- a/src/main/java/com/vertexvis/model/QueuedJobDataAttributes.java +++ b/src/main/java/com/vertexvis/model/QueuedJobDataAttributes.java @@ -14,89 +14,103 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApiError; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.LinkedHashSet; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import com.vertexvis.JSON; + /** * QueuedJobDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedJobDataAttributes { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_ERRORS = "errors"; @SerializedName(SERIALIZED_NAME_ERRORS) - private Set errors = null; + @javax.annotation.Nullable + private Set errors = new LinkedHashSet<>(); - public QueuedJobDataAttributes() { + public QueuedJobDataAttributes() { } - public QueuedJobDataAttributes status(String status) { - + public QueuedJobDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "running", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } - public QueuedJobDataAttributes created(OffsetDateTime created) { - + public QueuedJobDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public QueuedJobDataAttributes errors(Set errors) { - + public QueuedJobDataAttributes errors(@javax.annotation.Nullable Set errors) { this.errors = errors; return this; } @@ -109,23 +123,21 @@ public QueuedJobDataAttributes addErrorsItem(ApiError errorsItem) { return this; } - /** + /** * Get errors * @return errors - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Set getErrors() { return errors; } - - public void setErrors(Set errors) { + public void setErrors(@javax.annotation.Nullable Set errors) { this.errors = errors; } + @Override public boolean equals(Object o) { if (this == o) { @@ -167,5 +179,117 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("created"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedJobDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedJobDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedJobDataAttributes is not found in the empty JSON string", QueuedJobDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedJobDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedJobDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedJobDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ApiError.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedJobDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedJobDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedJobDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedJobDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedJobDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedJobDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedJobDataAttributes + * @throws IOException if the JSON string is invalid with respect to QueuedJobDataAttributes + */ + public static QueuedJobDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedJobDataAttributes.class); + } + + /** + * Convert an instance of QueuedJobDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedJobList.java b/src/main/java/com/vertexvis/model/QueuedJobList.java index 1d693f6..f063f20 100644 --- a/src/main/java/com/vertexvis/model/QueuedJobList.java +++ b/src/main/java/com/vertexvis/model/QueuedJobList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.QueuedJobData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueuedJobList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedJobList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public QueuedJobList() { + public QueuedJobList() { } - public QueuedJobList data(List data) { - + public QueuedJobList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public QueuedJobList addDataItem(QueuedJobData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public QueuedJobList links(Map links) { - + public QueuedJobList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public QueuedJobList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedJobList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedJobList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedJobList is not found in the empty JSON string", QueuedJobList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedJobList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedJobList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedJobList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + QueuedJobData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedJobList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedJobList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedJobList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedJobList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedJobList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedJobList given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedJobList + * @throws IOException if the JSON string is invalid with respect to QueuedJobList + */ + public static QueuedJobList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedJobList.class); + } + + /** + * Convert an instance of QueuedJobList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedTranslationJob.java b/src/main/java/com/vertexvis/model/QueuedTranslationJob.java index 8ad6553..2b5f319 100644 --- a/src/main/java/com/vertexvis/model/QueuedTranslationJob.java +++ b/src/main/java/com/vertexvis/model/QueuedTranslationJob.java @@ -14,73 +14,92 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfGeometrySetDataPartRevisionDataPartRenditionData; import com.vertexvis.model.Link; import com.vertexvis.model.QueuedTranslationJobData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.QueuedTranslationJobIncludedInner; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * QueuedTranslationJob */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedTranslationJob { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private QueuedTranslationJobData data; public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) - private List included = null; + @javax.annotation.Nullable + private List included = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public QueuedTranslationJob() { + public QueuedTranslationJob() { } - public QueuedTranslationJob data(QueuedTranslationJobData data) { - + public QueuedTranslationJob data(@javax.annotation.Nonnull QueuedTranslationJobData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueuedTranslationJobData getData() { return data; } - - public void setData(QueuedTranslationJobData data) { + public void setData(@javax.annotation.Nonnull QueuedTranslationJobData data) { this.data = data; } - public QueuedTranslationJob included(List included) { - + public QueuedTranslationJob included(@javax.annotation.Nullable List included) { this.included = included; return this; } - public QueuedTranslationJob addIncludedItem(AnyOfGeometrySetDataPartRevisionDataPartRenditionData includedItem) { + public QueuedTranslationJob addIncludedItem(QueuedTranslationJobIncludedInner includedItem) { if (this.included == null) { this.included = new ArrayList<>(); } @@ -88,25 +107,21 @@ public QueuedTranslationJob addIncludedItem(AnyOfGeometrySetDataPartRevisionData return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public List getIncluded() { + public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nullable List included) { this.included = included; } - public QueuedTranslationJob links(Map links) { - + public QueuedTranslationJob links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -119,23 +134,21 @@ public QueuedTranslationJob putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -177,5 +190,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedTranslationJob + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedTranslationJob.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedTranslationJob is not found in the empty JSON string", QueuedTranslationJob.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedTranslationJob.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedTranslationJob` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedTranslationJob.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + QueuedTranslationJobData.validateJsonElement(jsonObj.get("data")); + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + QueuedTranslationJobIncludedInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedTranslationJob.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedTranslationJob' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedTranslationJob.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedTranslationJob value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedTranslationJob read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedTranslationJob given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedTranslationJob + * @throws IOException if the JSON string is invalid with respect to QueuedTranslationJob + */ + public static QueuedTranslationJob fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedTranslationJob.class); + } + + /** + * Convert an instance of QueuedTranslationJob to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedTranslationJobData.java b/src/main/java/com/vertexvis/model/QueuedTranslationJobData.java index 1a39140..b5469bd 100644 --- a/src/main/java/com/vertexvis/model/QueuedTranslationJobData.java +++ b/src/main/java/com/vertexvis/model/QueuedTranslationJobData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.QueuedTranslationJobDataAttributes; import com.vertexvis.model.QueuedTranslationJobDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * QueuedTranslationJobData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedTranslationJobData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private QueuedTranslationJobDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private QueuedTranslationJobDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public QueuedTranslationJobData() { + public QueuedTranslationJobData() { } - public QueuedTranslationJobData type(String type) { - + public QueuedTranslationJobData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public QueuedTranslationJobData id(UUID id) { - + public QueuedTranslationJobData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public QueuedTranslationJobData attributes(QueuedTranslationJobDataAttributes attributes) { - + public QueuedTranslationJobData attributes(@javax.annotation.Nonnull QueuedTranslationJobDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public QueuedTranslationJobDataAttributes getAttributes() { return attributes; } - - public void setAttributes(QueuedTranslationJobDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull QueuedTranslationJobDataAttributes attributes) { this.attributes = attributes; } - public QueuedTranslationJobData relationships(QueuedTranslationJobDataRelationships relationships) { - + public QueuedTranslationJobData relationships(@javax.annotation.Nullable QueuedTranslationJobDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public QueuedTranslationJobDataRelationships getRelationships() { return relationships; } - - public void setRelationships(QueuedTranslationJobDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable QueuedTranslationJobDataRelationships relationships) { this.relationships = relationships; } - public QueuedTranslationJobData links(Map links) { - + public QueuedTranslationJobData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public QueuedTranslationJobData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedTranslationJobData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedTranslationJobData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedTranslationJobData is not found in the empty JSON string", QueuedTranslationJobData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedTranslationJobData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedTranslationJobData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedTranslationJobData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + QueuedTranslationJobDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + QueuedTranslationJobDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedTranslationJobData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedTranslationJobData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedTranslationJobData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedTranslationJobData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedTranslationJobData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedTranslationJobData given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedTranslationJobData + * @throws IOException if the JSON string is invalid with respect to QueuedTranslationJobData + */ + public static QueuedTranslationJobData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedTranslationJobData.class); + } + + /** + * Convert an instance of QueuedTranslationJobData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedTranslationJobDataAttributes.java b/src/main/java/com/vertexvis/model/QueuedTranslationJobDataAttributes.java index c66e323..2333c5a 100644 --- a/src/main/java/com/vertexvis/model/QueuedTranslationJobDataAttributes.java +++ b/src/main/java/com/vertexvis/model/QueuedTranslationJobDataAttributes.java @@ -14,116 +14,127 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApiError; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.LinkedHashSet; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import com.vertexvis.JSON; + /** * QueuedTranslationJobDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedTranslationJobDataAttributes { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_COMPLETED = "completed"; @SerializedName(SERIALIZED_NAME_COMPLETED) + @javax.annotation.Nullable private OffsetDateTime completed; public static final String SERIALIZED_NAME_ERRORS = "errors"; @SerializedName(SERIALIZED_NAME_ERRORS) - private Set errors = null; + @javax.annotation.Nullable + private Set errors = new LinkedHashSet<>(); - public QueuedTranslationJobDataAttributes() { + public QueuedTranslationJobDataAttributes() { } - public QueuedTranslationJobDataAttributes status(String status) { - + public QueuedTranslationJobDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "running", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } - public QueuedTranslationJobDataAttributes created(OffsetDateTime created) { - + public QueuedTranslationJobDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public QueuedTranslationJobDataAttributes completed(OffsetDateTime completed) { - + public QueuedTranslationJobDataAttributes completed(@javax.annotation.Nullable OffsetDateTime completed) { this.completed = completed; return this; } - /** + /** * Get completed * @return completed - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCompleted() { return completed; } - - public void setCompleted(OffsetDateTime completed) { + public void setCompleted(@javax.annotation.Nullable OffsetDateTime completed) { this.completed = completed; } - public QueuedTranslationJobDataAttributes errors(Set errors) { - + public QueuedTranslationJobDataAttributes errors(@javax.annotation.Nullable Set errors) { this.errors = errors; return this; } @@ -136,23 +147,21 @@ public QueuedTranslationJobDataAttributes addErrorsItem(ApiError errorsItem) { return this; } - /** + /** * Get errors * @return errors - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Set getErrors() { return errors; } - - public void setErrors(Set errors) { + public void setErrors(@javax.annotation.Nullable Set errors) { this.errors = errors; } + @Override public boolean equals(Object o) { if (this == o) { @@ -196,5 +205,118 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("created"); + openapiFields.add("completed"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedTranslationJobDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedTranslationJobDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedTranslationJobDataAttributes is not found in the empty JSON string", QueuedTranslationJobDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedTranslationJobDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedTranslationJobDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedTranslationJobDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ApiError.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedTranslationJobDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedTranslationJobDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedTranslationJobDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedTranslationJobDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedTranslationJobDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedTranslationJobDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedTranslationJobDataAttributes + * @throws IOException if the JSON string is invalid with respect to QueuedTranslationJobDataAttributes + */ + public static QueuedTranslationJobDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedTranslationJobDataAttributes.class); + } + + /** + * Convert an instance of QueuedTranslationJobDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedTranslationJobDataRelationships.java b/src/main/java/com/vertexvis/model/QueuedTranslationJobDataRelationships.java index f42d8f2..1aba6e1 100644 --- a/src/main/java/com/vertexvis/model/QueuedTranslationJobDataRelationships.java +++ b/src/main/java/com/vertexvis/model/QueuedTranslationJobDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,99 +22,113 @@ import com.vertexvis.model.GeometrySetRelationship; import com.vertexvis.model.PartRenditionRelationship; import com.vertexvis.model.PartRevisionRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * QueuedTranslationJobDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class QueuedTranslationJobDataRelationships { public static final String SERIALIZED_NAME_GEOMETRY_SET = "geometrySet"; @SerializedName(SERIALIZED_NAME_GEOMETRY_SET) + @javax.annotation.Nullable private GeometrySetRelationship geometrySet; public static final String SERIALIZED_NAME_PART_REVISION = "partRevision"; @SerializedName(SERIALIZED_NAME_PART_REVISION) + @javax.annotation.Nullable private PartRevisionRelationship partRevision; public static final String SERIALIZED_NAME_PART_RENDITION = "partRendition"; @SerializedName(SERIALIZED_NAME_PART_RENDITION) + @javax.annotation.Nullable private PartRenditionRelationship partRendition; - public QueuedTranslationJobDataRelationships() { + public QueuedTranslationJobDataRelationships() { } - public QueuedTranslationJobDataRelationships geometrySet(GeometrySetRelationship geometrySet) { - + public QueuedTranslationJobDataRelationships geometrySet(@javax.annotation.Nullable GeometrySetRelationship geometrySet) { this.geometrySet = geometrySet; return this; } - /** + /** * Get geometrySet * @return geometrySet - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public GeometrySetRelationship getGeometrySet() { return geometrySet; } - - public void setGeometrySet(GeometrySetRelationship geometrySet) { + public void setGeometrySet(@javax.annotation.Nullable GeometrySetRelationship geometrySet) { this.geometrySet = geometrySet; } - public QueuedTranslationJobDataRelationships partRevision(PartRevisionRelationship partRevision) { - + public QueuedTranslationJobDataRelationships partRevision(@javax.annotation.Nullable PartRevisionRelationship partRevision) { this.partRevision = partRevision; return this; } - /** + /** * Get partRevision * @return partRevision - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRevisionRelationship getPartRevision() { return partRevision; } - - public void setPartRevision(PartRevisionRelationship partRevision) { + public void setPartRevision(@javax.annotation.Nullable PartRevisionRelationship partRevision) { this.partRevision = partRevision; } - public QueuedTranslationJobDataRelationships partRendition(PartRenditionRelationship partRendition) { - + public QueuedTranslationJobDataRelationships partRendition(@javax.annotation.Nullable PartRenditionRelationship partRendition) { this.partRendition = partRendition; return this; } - /** + /** * Get partRendition * @return partRendition - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRenditionRelationship getPartRendition() { return partRendition; } - - public void setPartRendition(PartRenditionRelationship partRendition) { + public void setPartRendition(@javax.annotation.Nullable PartRenditionRelationship partRendition) { this.partRendition = partRendition; } + @Override public boolean equals(Object o) { if (this == o) { @@ -157,5 +170,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("geometrySet"); + openapiFields.add("partRevision"); + openapiFields.add("partRendition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedTranslationJobDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedTranslationJobDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueuedTranslationJobDataRelationships is not found in the empty JSON string", QueuedTranslationJobDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueuedTranslationJobDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueuedTranslationJobDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `geometrySet` + if (jsonObj.get("geometrySet") != null && !jsonObj.get("geometrySet").isJsonNull()) { + GeometrySetRelationship.validateJsonElement(jsonObj.get("geometrySet")); + } + // validate the optional field `partRevision` + if (jsonObj.get("partRevision") != null && !jsonObj.get("partRevision").isJsonNull()) { + PartRevisionRelationship.validateJsonElement(jsonObj.get("partRevision")); + } + // validate the optional field `partRendition` + if (jsonObj.get("partRendition") != null && !jsonObj.get("partRendition").isJsonNull()) { + PartRenditionRelationship.validateJsonElement(jsonObj.get("partRendition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedTranslationJobDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedTranslationJobDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedTranslationJobDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedTranslationJobDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueuedTranslationJobDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QueuedTranslationJobDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedTranslationJobDataRelationships + * @throws IOException if the JSON string is invalid with respect to QueuedTranslationJobDataRelationships + */ + public static QueuedTranslationJobDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedTranslationJobDataRelationships.class); + } + + /** + * Convert an instance of QueuedTranslationJobDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/QueuedTranslationJobIncludedInner.java b/src/main/java/com/vertexvis/model/QueuedTranslationJobIncludedInner.java new file mode 100644 index 0000000..f60b98d --- /dev/null +++ b/src/main/java/com/vertexvis/model/QueuedTranslationJobIncludedInner.java @@ -0,0 +1,319 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.GeometrySetData; +import com.vertexvis.model.Link; +import com.vertexvis.model.PartRenditionData; +import com.vertexvis.model.PartRenditionDataAttributes; +import com.vertexvis.model.PartRenditionDataRelationships; +import com.vertexvis.model.PartRevisionData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class QueuedTranslationJobIncludedInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(QueuedTranslationJobIncludedInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedTranslationJobIncludedInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedTranslationJobIncludedInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterGeometrySetData = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetData.class)); + final TypeAdapter adapterPartRevisionData = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionData.class)); + final TypeAdapter adapterPartRenditionData = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedTranslationJobIncludedInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `GeometrySetData` + if (value.getActualInstance() instanceof GeometrySetData) { + JsonElement element = adapterGeometrySetData.toJsonTree((GeometrySetData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionData` + if (value.getActualInstance() instanceof PartRevisionData) { + JsonElement element = adapterPartRevisionData.toJsonTree((PartRevisionData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRenditionData` + if (value.getActualInstance() instanceof PartRenditionData) { + JsonElement element = adapterPartRenditionData.toJsonTree((PartRenditionData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: GeometrySetData, PartRenditionData, PartRevisionData"); + } + + @Override + public QueuedTranslationJobIncludedInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GeometrySetData + try { + // validate the JSON object to see if any exception is thrown + GeometrySetData.validateJsonElement(jsonElement); + actualAdapter = adapterGeometrySetData; + QueuedTranslationJobIncludedInner ret = new QueuedTranslationJobIncludedInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for GeometrySetData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'GeometrySetData'", e); + } + // deserialize PartRevisionData + try { + // validate the JSON object to see if any exception is thrown + PartRevisionData.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionData; + QueuedTranslationJobIncludedInner ret = new QueuedTranslationJobIncludedInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionData'", e); + } + // deserialize PartRenditionData + try { + // validate the JSON object to see if any exception is thrown + PartRenditionData.validateJsonElement(jsonElement); + actualAdapter = adapterPartRenditionData; + QueuedTranslationJobIncludedInner ret = new QueuedTranslationJobIncludedInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRenditionData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRenditionData'", e); + } + + throw new IOException(String.format("Failed deserialization for QueuedTranslationJobIncludedInner: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public QueuedTranslationJobIncludedInner() { + super("anyOf", Boolean.FALSE); + } + + public QueuedTranslationJobIncludedInner(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeometrySetData", GeometrySetData.class); + schemas.put("PartRevisionData", PartRevisionData.class); + schemas.put("PartRenditionData", PartRenditionData.class); + } + + @Override + public Map> getSchemas() { + return QueuedTranslationJobIncludedInner.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * GeometrySetData, PartRenditionData, PartRevisionData + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GeometrySetData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRenditionData) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be GeometrySetData, PartRenditionData, PartRevisionData"); + } + + /** + * Get the actual instance, which can be the following: + * GeometrySetData, PartRenditionData, PartRevisionData + * + * @return The actual instance (GeometrySetData, PartRenditionData, PartRevisionData) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeometrySetData`. If the actual instance is not `GeometrySetData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GeometrySetData` + * @throws ClassCastException if the instance is not `GeometrySetData` + */ + public GeometrySetData getGeometrySetData() throws ClassCastException { + return (GeometrySetData)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionData`. If the actual instance is not `PartRevisionData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionData` + * @throws ClassCastException if the instance is not `PartRevisionData` + */ + public PartRevisionData getPartRevisionData() throws ClassCastException { + return (PartRevisionData)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRenditionData`. If the actual instance is not `PartRenditionData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRenditionData` + * @throws ClassCastException if the instance is not `PartRenditionData` + */ + public PartRenditionData getPartRenditionData() throws ClassCastException { + return (PartRenditionData)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueuedTranslationJobIncludedInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GeometrySetData + try { + GeometrySetData.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for GeometrySetData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionData + try { + PartRevisionData.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRenditionData + try { + PartRenditionData.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRenditionData failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for QueuedTranslationJobIncludedInner with anyOf schemas: GeometrySetData, PartRenditionData, PartRevisionData. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of QueuedTranslationJobIncludedInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedTranslationJobIncludedInner + * @throws IOException if the JSON string is invalid with respect to QueuedTranslationJobIncludedInner + */ + public static QueuedTranslationJobIncludedInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedTranslationJobIncludedInner.class); + } + + /** + * Convert an instance of QueuedTranslationJobIncludedInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/RelationshipData.java b/src/main/java/com/vertexvis/model/RelationshipData.java index 40fedb0..1458c91 100644 --- a/src/main/java/com/vertexvis/model/RelationshipData.java +++ b/src/main/java/com/vertexvis/model/RelationshipData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * RelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class RelationshipData { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; - public RelationshipData() { + public RelationshipData() { } - public RelationshipData id(UUID id) { - + public RelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public RelationshipData type(String type) { - + public RelationshipData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipData is not found in the empty JSON string", RelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipData + * @throws IOException if the JSON string is invalid with respect to RelationshipData + */ + public static RelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipData.class); + } + + /** + * Convert an instance of RelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/RelationshipLinks.java b/src/main/java/com/vertexvis/model/RelationshipLinks.java index d47cbaf..4975f25 100644 --- a/src/main/java/com/vertexvis/model/RelationshipLinks.java +++ b/src/main/java/com/vertexvis/model/RelationshipLinks.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * RelationshipLinks */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class RelationshipLinks { public static final String SERIALIZED_NAME_RELATED = "related"; @SerializedName(SERIALIZED_NAME_RELATED) + @javax.annotation.Nonnull private String related; - public RelationshipLinks() { + public RelationshipLinks() { } - public RelationshipLinks related(String related) { - + public RelationshipLinks related(@javax.annotation.Nonnull String related) { this.related = related; return this; } - /** + /** * Get related * @return related - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "/some-resource/d98d621a-23da-49fe-af96-6be709abb718", required = true, value = "") - public String getRelated() { return related; } - - public void setRelated(String related) { + public void setRelated(@javax.annotation.Nonnull String related) { this.related = related; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("related"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("related"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipLinks + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipLinks.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipLinks is not found in the empty JSON string", RelationshipLinks.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipLinks.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipLinks` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipLinks.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("related").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `related` to be a primitive type in the JSON string but got `%s`", jsonObj.get("related").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipLinks.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipLinks' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipLinks.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipLinks value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipLinks read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipLinks given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipLinks + * @throws IOException if the JSON string is invalid with respect to RelationshipLinks + */ + public static RelationshipLinks fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipLinks.class); + } + + /** + * Convert an instance of RelationshipLinks to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequest.java b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequest.java index bc8296c..c63895c 100644 --- a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequest.java +++ b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RevokeOAuth2TokenRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * RevokeOAuth2TokenRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class RevokeOAuth2TokenRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private RevokeOAuth2TokenRequestData data; - public RevokeOAuth2TokenRequest() { + public RevokeOAuth2TokenRequest() { } - public RevokeOAuth2TokenRequest data(RevokeOAuth2TokenRequestData data) { - + public RevokeOAuth2TokenRequest data(@javax.annotation.Nonnull RevokeOAuth2TokenRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public RevokeOAuth2TokenRequestData getData() { return data; } - - public void setData(RevokeOAuth2TokenRequestData data) { + public void setData(@javax.annotation.Nonnull RevokeOAuth2TokenRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RevokeOAuth2TokenRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RevokeOAuth2TokenRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RevokeOAuth2TokenRequest is not found in the empty JSON string", RevokeOAuth2TokenRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RevokeOAuth2TokenRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RevokeOAuth2TokenRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RevokeOAuth2TokenRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RevokeOAuth2TokenRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RevokeOAuth2TokenRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RevokeOAuth2TokenRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RevokeOAuth2TokenRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RevokeOAuth2TokenRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RevokeOAuth2TokenRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RevokeOAuth2TokenRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of RevokeOAuth2TokenRequest + * @throws IOException if the JSON string is invalid with respect to RevokeOAuth2TokenRequest + */ + public static RevokeOAuth2TokenRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RevokeOAuth2TokenRequest.class); + } + + /** + * Convert an instance of RevokeOAuth2TokenRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestData.java b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestData.java index 9607108..c60ba5f 100644 --- a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestData.java +++ b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RevokeOAuth2TokenRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * RevokeOAuth2TokenRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class RevokeOAuth2TokenRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private RevokeOAuth2TokenRequestDataAttributes attributes; - public RevokeOAuth2TokenRequestData() { + public RevokeOAuth2TokenRequestData() { } - public RevokeOAuth2TokenRequestData type(String type) { - + public RevokeOAuth2TokenRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "oauth2", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public RevokeOAuth2TokenRequestData attributes(RevokeOAuth2TokenRequestDataAttributes attributes) { - + public RevokeOAuth2TokenRequestData attributes(@javax.annotation.Nonnull RevokeOAuth2TokenRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public RevokeOAuth2TokenRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(RevokeOAuth2TokenRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull RevokeOAuth2TokenRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RevokeOAuth2TokenRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RevokeOAuth2TokenRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RevokeOAuth2TokenRequestData is not found in the empty JSON string", RevokeOAuth2TokenRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RevokeOAuth2TokenRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RevokeOAuth2TokenRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RevokeOAuth2TokenRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + RevokeOAuth2TokenRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RevokeOAuth2TokenRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RevokeOAuth2TokenRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RevokeOAuth2TokenRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RevokeOAuth2TokenRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RevokeOAuth2TokenRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RevokeOAuth2TokenRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RevokeOAuth2TokenRequestData + * @throws IOException if the JSON string is invalid with respect to RevokeOAuth2TokenRequestData + */ + public static RevokeOAuth2TokenRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RevokeOAuth2TokenRequestData.class); + } + + /** + * Convert an instance of RevokeOAuth2TokenRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestDataAttributes.java b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestDataAttributes.java index ac95367..6e51650 100644 --- a/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/RevokeOAuth2TokenRequestDataAttributes.java @@ -14,51 +14,70 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * RevokeOAuth2TokenRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class RevokeOAuth2TokenRequestDataAttributes { public static final String SERIALIZED_NAME_TOKEN = "token"; @SerializedName(SERIALIZED_NAME_TOKEN) + @javax.annotation.Nonnull private String token; - public RevokeOAuth2TokenRequestDataAttributes() { + public RevokeOAuth2TokenRequestDataAttributes() { } - public RevokeOAuth2TokenRequestDataAttributes token(String token) { - + public RevokeOAuth2TokenRequestDataAttributes token(@javax.annotation.Nonnull String token) { this.token = token; return this; } - /** + /** * Token to revoke. * @return token - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "yj4oeKWCib6JlLsN64Ns.9CyY4gvhueXfCw6wPBJ6", required = true, value = "Token to revoke.") - public String getToken() { return token; } - - public void setToken(String token) { + public void setToken(@javax.annotation.Nonnull String token) { this.token = token; } + @Override public boolean equals(Object o) { if (this == o) { @@ -96,5 +115,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RevokeOAuth2TokenRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RevokeOAuth2TokenRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RevokeOAuth2TokenRequestDataAttributes is not found in the empty JSON string", RevokeOAuth2TokenRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RevokeOAuth2TokenRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RevokeOAuth2TokenRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RevokeOAuth2TokenRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RevokeOAuth2TokenRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RevokeOAuth2TokenRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RevokeOAuth2TokenRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RevokeOAuth2TokenRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RevokeOAuth2TokenRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RevokeOAuth2TokenRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RevokeOAuth2TokenRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to RevokeOAuth2TokenRequestDataAttributes + */ + public static RevokeOAuth2TokenRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RevokeOAuth2TokenRequestDataAttributes.class); + } + + /** + * Convert an instance of RevokeOAuth2TokenRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Scene.java b/src/main/java/com/vertexvis/model/Scene.java index 543d43b..d9545f4 100644 --- a/src/main/java/com/vertexvis/model/Scene.java +++ b/src/main/java/com/vertexvis/model/Scene.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Scene */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Scene { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public Scene() { + public Scene() { } - public Scene data(SceneData data) { - + public Scene data(@javax.annotation.Nonnull SceneData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneData getData() { return data; } - - public void setData(SceneData data) { + public void setData(@javax.annotation.Nonnull SceneData data) { this.data = data; } - public Scene links(Map links) { - + public Scene links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public Scene putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Scene + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Scene.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Scene is not found in the empty JSON string", Scene.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Scene.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Scene` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Scene.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Scene.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Scene' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Scene.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Scene value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Scene read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Scene given an JSON string + * + * @param jsonString JSON string + * @return An instance of Scene + * @throws IOException if the JSON string is invalid with respect to Scene + */ + public static Scene fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Scene.class); + } + + /** + * Convert an instance of Scene to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneAlteration.java b/src/main/java/com/vertexvis/model/SceneAlteration.java index 25cead6..8bfac82 100644 --- a/src/main/java/com/vertexvis/model/SceneAlteration.java +++ b/src/main/java/com/vertexvis/model/SceneAlteration.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneAlterationData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneAlteration */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneAlteration { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneAlterationData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneAlteration() { + public SceneAlteration() { } - public SceneAlteration data(SceneAlterationData data) { - + public SceneAlteration data(@javax.annotation.Nonnull SceneAlterationData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneAlterationData getData() { return data; } - - public void setData(SceneAlterationData data) { + public void setData(@javax.annotation.Nonnull SceneAlterationData data) { this.data = data; } - public SceneAlteration links(Map links) { - + public SceneAlteration links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneAlteration putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAlteration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAlteration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAlteration is not found in the empty JSON string", SceneAlteration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAlteration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAlteration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAlteration.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneAlterationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAlteration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAlteration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAlteration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAlteration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAlteration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAlteration given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAlteration + * @throws IOException if the JSON string is invalid with respect to SceneAlteration + */ + public static SceneAlteration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAlteration.class); + } + + /** + * Convert an instance of SceneAlteration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneAlterationData.java b/src/main/java/com/vertexvis/model/SceneAlterationData.java index 1a481e9..96cd561 100644 --- a/src/main/java/com/vertexvis/model/SceneAlterationData.java +++ b/src/main/java/com/vertexvis/model/SceneAlterationData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.HitDataAttributes; import com.vertexvis.model.Link; import com.vertexvis.model.SceneAlterationDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneAlterationData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneAlterationData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private HitDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneAlterationDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneAlterationData() { + public SceneAlterationData() { } - public SceneAlterationData type(String type) { - + public SceneAlterationData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-alteration", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneAlterationData id(UUID id) { - + public SceneAlterationData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneAlterationData attributes(HitDataAttributes attributes) { - + public SceneAlterationData attributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public HitDataAttributes getAttributes() { return attributes; } - - public void setAttributes(HitDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull HitDataAttributes attributes) { this.attributes = attributes; } - public SceneAlterationData relationships(SceneAlterationDataRelationships relationships) { - + public SceneAlterationData relationships(@javax.annotation.Nonnull SceneAlterationDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneAlterationDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneAlterationDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneAlterationDataRelationships relationships) { this.relationships = relationships; } - public SceneAlterationData links(Map links) { - + public SceneAlterationData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public SceneAlterationData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAlterationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAlterationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAlterationData is not found in the empty JSON string", SceneAlterationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAlterationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAlterationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAlterationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + HitDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneAlterationDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAlterationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAlterationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAlterationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAlterationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAlterationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAlterationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAlterationData + * @throws IOException if the JSON string is invalid with respect to SceneAlterationData + */ + public static SceneAlterationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAlterationData.class); + } + + /** + * Convert an instance of SceneAlterationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneAlterationDataRelationships.java b/src/main/java/com/vertexvis/model/SceneAlterationDataRelationships.java index 0c52bc8..9a658bc 100644 --- a/src/main/java/com/vertexvis/model/SceneAlterationDataRelationships.java +++ b/src/main/java/com/vertexvis/model/SceneAlterationDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneViewRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneAlterationDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneAlterationDataRelationships { public static final String SERIALIZED_NAME_SCENE_VIEW = "sceneView"; @SerializedName(SERIALIZED_NAME_SCENE_VIEW) + @javax.annotation.Nonnull private SceneViewRelationship sceneView; - public SceneAlterationDataRelationships() { + public SceneAlterationDataRelationships() { } - public SceneAlterationDataRelationships sceneView(SceneViewRelationship sceneView) { - + public SceneAlterationDataRelationships sceneView(@javax.annotation.Nonnull SceneViewRelationship sceneView) { this.sceneView = sceneView; return this; } - /** + /** * Get sceneView * @return sceneView - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewRelationship getSceneView() { return sceneView; } - - public void setSceneView(SceneViewRelationship sceneView) { + public void setSceneView(@javax.annotation.Nonnull SceneViewRelationship sceneView) { this.sceneView = sceneView; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sceneView"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sceneView"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAlterationDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAlterationDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAlterationDataRelationships is not found in the empty JSON string", SceneAlterationDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAlterationDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAlterationDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAlterationDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `sceneView` + SceneViewRelationship.validateJsonElement(jsonObj.get("sceneView")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAlterationDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAlterationDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAlterationDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAlterationDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAlterationDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAlterationDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAlterationDataRelationships + * @throws IOException if the JSON string is invalid with respect to SceneAlterationDataRelationships + */ + public static SceneAlterationDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAlterationDataRelationships.class); + } + + /** + * Convert an instance of SceneAlterationDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneAlterationList.java b/src/main/java/com/vertexvis/model/SceneAlterationList.java index 0ac2113..89418f2 100644 --- a/src/main/java/com/vertexvis/model/SceneAlterationList.java +++ b/src/main/java/com/vertexvis/model/SceneAlterationList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneAlterationData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneAlterationList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneAlterationList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneAlterationList() { + public SceneAlterationList() { } - public SceneAlterationList data(List data) { - + public SceneAlterationList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneAlterationList addDataItem(SceneAlterationData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneAlterationList links(Map links) { - + public SceneAlterationList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneAlterationList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAlterationList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAlterationList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAlterationList is not found in the empty JSON string", SceneAlterationList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAlterationList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAlterationList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAlterationList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneAlterationData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAlterationList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAlterationList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAlterationList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAlterationList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAlterationList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAlterationList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAlterationList + * @throws IOException if the JSON string is invalid with respect to SceneAlterationList + */ + public static SceneAlterationList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAlterationList.class); + } + + /** + * Convert an instance of SceneAlterationList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneAnnotation.java b/src/main/java/com/vertexvis/model/SceneAnnotation.java new file mode 100644 index 0000000..8fc6a03 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotation.java @@ -0,0 +1,252 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.SceneAnnotationData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotation { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private SceneAnnotationData data; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public SceneAnnotation() { + } + + public SceneAnnotation data(@javax.annotation.Nonnull SceneAnnotationData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public SceneAnnotationData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull SceneAnnotationData data) { + this.data = data; + } + + + public SceneAnnotation links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public SceneAnnotation putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotation sceneAnnotation = (SceneAnnotation) o; + return Objects.equals(this.data, sceneAnnotation.data) && + Objects.equals(this.links, sceneAnnotation.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotation {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotation is not found in the empty JSON string", SceneAnnotation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneAnnotationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotation given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotation + * @throws IOException if the JSON string is invalid with respect to SceneAnnotation + */ + public static SceneAnnotation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotation.class); + } + + /** + * Convert an instance of SceneAnnotation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationCalloutDataType.java b/src/main/java/com/vertexvis/model/SceneAnnotationCalloutDataType.java new file mode 100644 index 0000000..adc187a --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationCalloutDataType.java @@ -0,0 +1,335 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Vector3; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * A type that describes a callout annotation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationCalloutDataType { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_POSITION = "position"; + @SerializedName(SERIALIZED_NAME_POSITION) + @javax.annotation.Nonnull + private Vector3 position; + + public static final String SERIALIZED_NAME_ICON = "icon"; + @SerializedName(SERIALIZED_NAME_ICON) + @javax.annotation.Nullable + private String icon; + + public static final String SERIALIZED_NAME_PRIMARY_COLOR = "primaryColor"; + @SerializedName(SERIALIZED_NAME_PRIMARY_COLOR) + @javax.annotation.Nullable + private String primaryColor; + + public static final String SERIALIZED_NAME_ACCENT_COLOR = "accentColor"; + @SerializedName(SERIALIZED_NAME_ACCENT_COLOR) + @javax.annotation.Nullable + private String accentColor; + + public SceneAnnotationCalloutDataType() { + } + + public SceneAnnotationCalloutDataType type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of annotation. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public SceneAnnotationCalloutDataType position(@javax.annotation.Nonnull Vector3 position) { + this.position = position; + return this; + } + + /** + * Get position + * @return position + */ + @javax.annotation.Nonnull + public Vector3 getPosition() { + return position; + } + + public void setPosition(@javax.annotation.Nonnull Vector3 position) { + this.position = position; + } + + + public SceneAnnotationCalloutDataType icon(@javax.annotation.Nullable String icon) { + this.icon = icon; + return this; + } + + /** + * An optional icon to display for this annotation. See [documentation](https://github.com/Vertexvis/vertex-web-sdk/tree/master/packages/viewer/src/components/viewer-icon#properties) for possible values. + * @return icon + */ + @javax.annotation.Nullable + public String getIcon() { + return icon; + } + + public void setIcon(@javax.annotation.Nullable String icon) { + this.icon = icon; + } + + + public SceneAnnotationCalloutDataType primaryColor(@javax.annotation.Nullable String primaryColor) { + this.primaryColor = primaryColor; + return this; + } + + /** + * A hex color value. + * @return primaryColor + */ + @javax.annotation.Nullable + public String getPrimaryColor() { + return primaryColor; + } + + public void setPrimaryColor(@javax.annotation.Nullable String primaryColor) { + this.primaryColor = primaryColor; + } + + + public SceneAnnotationCalloutDataType accentColor(@javax.annotation.Nullable String accentColor) { + this.accentColor = accentColor; + return this; + } + + /** + * A hex color value. + * @return accentColor + */ + @javax.annotation.Nullable + public String getAccentColor() { + return accentColor; + } + + public void setAccentColor(@javax.annotation.Nullable String accentColor) { + this.accentColor = accentColor; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationCalloutDataType sceneAnnotationCalloutDataType = (SceneAnnotationCalloutDataType) o; + return Objects.equals(this.type, sceneAnnotationCalloutDataType.type) && + Objects.equals(this.position, sceneAnnotationCalloutDataType.position) && + Objects.equals(this.icon, sceneAnnotationCalloutDataType.icon) && + Objects.equals(this.primaryColor, sceneAnnotationCalloutDataType.primaryColor) && + Objects.equals(this.accentColor, sceneAnnotationCalloutDataType.accentColor); + } + + @Override + public int hashCode() { + return Objects.hash(type, position, icon, primaryColor, accentColor); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationCalloutDataType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" position: ").append(toIndentedString(position)).append("\n"); + sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); + sb.append(" primaryColor: ").append(toIndentedString(primaryColor)).append("\n"); + sb.append(" accentColor: ").append(toIndentedString(accentColor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("position"); + openapiFields.add("icon"); + openapiFields.add("primaryColor"); + openapiFields.add("accentColor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("position"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationCalloutDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationCalloutDataType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationCalloutDataType is not found in the empty JSON string", SceneAnnotationCalloutDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationCalloutDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationCalloutDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationCalloutDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `position` + Vector3.validateJsonElement(jsonObj.get("position")); + if ((jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) && !jsonObj.get("icon").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `icon` to be a primitive type in the JSON string but got `%s`", jsonObj.get("icon").toString())); + } + if ((jsonObj.get("primaryColor") != null && !jsonObj.get("primaryColor").isJsonNull()) && !jsonObj.get("primaryColor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `primaryColor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("primaryColor").toString())); + } + if ((jsonObj.get("accentColor") != null && !jsonObj.get("accentColor").isJsonNull()) && !jsonObj.get("accentColor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accentColor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accentColor").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationCalloutDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationCalloutDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationCalloutDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationCalloutDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationCalloutDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationCalloutDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationCalloutDataType + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationCalloutDataType + */ + public static SceneAnnotationCalloutDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationCalloutDataType.class); + } + + /** + * Convert an instance of SceneAnnotationCalloutDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationCustomDataType.java b/src/main/java/com/vertexvis/model/SceneAnnotationCustomDataType.java new file mode 100644 index 0000000..ffad371 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationCustomDataType.java @@ -0,0 +1,276 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * A type that describes a custom user provided annotation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationCustomDataType { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_JSON_TYPE = "jsonType"; + @SerializedName(SERIALIZED_NAME_JSON_TYPE) + @javax.annotation.Nonnull + private String jsonType; + + public static final String SERIALIZED_NAME_JSON = "json"; + @SerializedName(SERIALIZED_NAME_JSON) + @javax.annotation.Nonnull + private String json; + + public SceneAnnotationCustomDataType() { + } + + public SceneAnnotationCustomDataType type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of annotation. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public SceneAnnotationCustomDataType jsonType(@javax.annotation.Nonnull String jsonType) { + this.jsonType = jsonType; + return this; + } + + /** + * The type of annotation. + * @return jsonType + */ + @javax.annotation.Nonnull + public String getJsonType() { + return jsonType; + } + + public void setJsonType(@javax.annotation.Nonnull String jsonType) { + this.jsonType = jsonType; + } + + + public SceneAnnotationCustomDataType json(@javax.annotation.Nonnull String json) { + this.json = json; + return this; + } + + /** + * An encoded JSON string associated with the custom annotation. + * @return json + */ + @javax.annotation.Nonnull + public String getJson() { + return json; + } + + public void setJson(@javax.annotation.Nonnull String json) { + this.json = json; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationCustomDataType sceneAnnotationCustomDataType = (SceneAnnotationCustomDataType) o; + return Objects.equals(this.type, sceneAnnotationCustomDataType.type) && + Objects.equals(this.jsonType, sceneAnnotationCustomDataType.jsonType) && + Objects.equals(this.json, sceneAnnotationCustomDataType.json); + } + + @Override + public int hashCode() { + return Objects.hash(type, jsonType, json); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationCustomDataType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" jsonType: ").append(toIndentedString(jsonType)).append("\n"); + sb.append(" json: ").append(toIndentedString(json)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("jsonType"); + openapiFields.add("json"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("jsonType"); + openapiRequiredFields.add("json"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationCustomDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationCustomDataType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationCustomDataType is not found in the empty JSON string", SceneAnnotationCustomDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationCustomDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationCustomDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationCustomDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("jsonType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jsonType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jsonType").toString())); + } + if (!jsonObj.get("json").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `json` to be a primitive type in the JSON string but got `%s`", jsonObj.get("json").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationCustomDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationCustomDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationCustomDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationCustomDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationCustomDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationCustomDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationCustomDataType + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationCustomDataType + */ + public static SceneAnnotationCustomDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationCustomDataType.class); + } + + /** + * Convert an instance of SceneAnnotationCustomDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationData.java b/src/main/java/com/vertexvis/model/SceneAnnotationData.java new file mode 100644 index 0000000..4298da5 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationData.java @@ -0,0 +1,315 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.SceneAnnotationDataAttributes; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private SceneAnnotationDataAttributes attributes; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public SceneAnnotationData() { + } + + public SceneAnnotationData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public SceneAnnotationData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public SceneAnnotationData attributes(@javax.annotation.Nonnull SceneAnnotationDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public SceneAnnotationDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull SceneAnnotationDataAttributes attributes) { + this.attributes = attributes; + } + + + public SceneAnnotationData links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public SceneAnnotationData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationData sceneAnnotationData = (SceneAnnotationData) o; + return Objects.equals(this.type, sceneAnnotationData.type) && + Objects.equals(this.id, sceneAnnotationData.id) && + Objects.equals(this.attributes, sceneAnnotationData.attributes) && + Objects.equals(this.links, sceneAnnotationData.links); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationData is not found in the empty JSON string", SceneAnnotationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneAnnotationDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationData + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationData + */ + public static SceneAnnotationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationData.class); + } + + /** + * Convert an instance of SceneAnnotationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationDataAttributes.java b/src/main/java/com/vertexvis/model/SceneAnnotationDataAttributes.java new file mode 100644 index 0000000..75d3847 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationDataAttributes.java @@ -0,0 +1,301 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationDataAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_MODIFIED_AT = "modifiedAt"; + @SerializedName(SERIALIZED_NAME_MODIFIED_AT) + @javax.annotation.Nonnull + private OffsetDateTime modifiedAt; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private CreateSceneAnnotationRequestDataAttributesData data; + + public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable + private String suppliedId; + + public SceneAnnotationDataAttributes() { + } + + public SceneAnnotationDataAttributes createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SceneAnnotationDataAttributes modifiedAt(@javax.annotation.Nonnull OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Get modifiedAt + * @return modifiedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(@javax.annotation.Nonnull OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + + public SceneAnnotationDataAttributes data(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public CreateSceneAnnotationRequestDataAttributesData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + } + + + public SceneAnnotationDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + return this; + } + + /** + * Get suppliedId + * @return suppliedId + */ + @javax.annotation.Nullable + public String getSuppliedId() { + return suppliedId; + } + + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationDataAttributes sceneAnnotationDataAttributes = (SceneAnnotationDataAttributes) o; + return Objects.equals(this.createdAt, sceneAnnotationDataAttributes.createdAt) && + Objects.equals(this.modifiedAt, sceneAnnotationDataAttributes.modifiedAt) && + Objects.equals(this.data, sceneAnnotationDataAttributes.data) && + Objects.equals(this.suppliedId, sceneAnnotationDataAttributes.suppliedId); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, modifiedAt, data, suppliedId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationDataAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("modifiedAt"); + openapiFields.add("data"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("modifiedAt"); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationDataAttributes is not found in the empty JSON string", SceneAnnotationDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateSceneAnnotationRequestDataAttributesData.validateJsonElement(jsonObj.get("data")); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationDataAttributes + */ + public static SceneAnnotationDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationDataAttributes.class); + } + + /** + * Convert an instance of SceneAnnotationDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationSet.java b/src/main/java/com/vertexvis/model/SceneAnnotationSet.java new file mode 100644 index 0000000..5732605 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationSet.java @@ -0,0 +1,252 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.SceneAnnotationSetData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationSet { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private SceneAnnotationSetData data; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public SceneAnnotationSet() { + } + + public SceneAnnotationSet data(@javax.annotation.Nonnull SceneAnnotationSetData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public SceneAnnotationSetData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull SceneAnnotationSetData data) { + this.data = data; + } + + + public SceneAnnotationSet links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public SceneAnnotationSet putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationSet sceneAnnotationSet = (SceneAnnotationSet) o; + return Objects.equals(this.data, sceneAnnotationSet.data) && + Objects.equals(this.links, sceneAnnotationSet.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationSet {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationSet is not found in the empty JSON string", SceneAnnotationSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationSet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneAnnotationSetData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationSet + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationSet + */ + public static SceneAnnotationSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationSet.class); + } + + /** + * Convert an instance of SceneAnnotationSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationSetData.java b/src/main/java/com/vertexvis/model/SceneAnnotationSetData.java new file mode 100644 index 0000000..e61bceb --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationSetData.java @@ -0,0 +1,315 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.SceneAnnotationSetDataAttributes; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationSetData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationSetData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private SceneAnnotationSetDataAttributes attributes; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private Map links = new HashMap<>(); + + public SceneAnnotationSetData() { + } + + public SceneAnnotationSetData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public SceneAnnotationSetData id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * ID of the resource. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public SceneAnnotationSetData attributes(@javax.annotation.Nonnull SceneAnnotationSetDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public SceneAnnotationSetDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull SceneAnnotationSetDataAttributes attributes) { + this.attributes = attributes; + } + + + public SceneAnnotationSetData links(@javax.annotation.Nullable Map links) { + this.links = links; + return this; + } + + public SceneAnnotationSetData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationSetData sceneAnnotationSetData = (SceneAnnotationSetData) o; + return Objects.equals(this.type, sceneAnnotationSetData.type) && + Objects.equals(this.id, sceneAnnotationSetData.id) && + Objects.equals(this.attributes, sceneAnnotationSetData.attributes) && + Objects.equals(this.links, sceneAnnotationSetData.links); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationSetData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationSetData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationSetData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationSetData is not found in the empty JSON string", SceneAnnotationSetData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationSetData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationSetData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationSetData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneAnnotationSetDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationSetData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationSetData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationSetData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationSetData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationSetData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationSetData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationSetData + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationSetData + */ + public static SceneAnnotationSetData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationSetData.class); + } + + /** + * Convert an instance of SceneAnnotationSetData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationSetDataAttributes.java b/src/main/java/com/vertexvis/model/SceneAnnotationSetDataAttributes.java new file mode 100644 index 0000000..94628fc --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationSetDataAttributes.java @@ -0,0 +1,300 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationSetDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationSetDataAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_MODIFIED_AT = "modifiedAt"; + @SerializedName(SERIALIZED_NAME_MODIFIED_AT) + @javax.annotation.Nonnull + private OffsetDateTime modifiedAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable + private String suppliedId; + + public SceneAnnotationSetDataAttributes() { + } + + public SceneAnnotationSetDataAttributes createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SceneAnnotationSetDataAttributes modifiedAt(@javax.annotation.Nonnull OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Get modifiedAt + * @return modifiedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(@javax.annotation.Nonnull OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + + public SceneAnnotationSetDataAttributes name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SceneAnnotationSetDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + return this; + } + + /** + * Get suppliedId + * @return suppliedId + */ + @javax.annotation.Nullable + public String getSuppliedId() { + return suppliedId; + } + + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationSetDataAttributes sceneAnnotationSetDataAttributes = (SceneAnnotationSetDataAttributes) o; + return Objects.equals(this.createdAt, sceneAnnotationSetDataAttributes.createdAt) && + Objects.equals(this.modifiedAt, sceneAnnotationSetDataAttributes.modifiedAt) && + Objects.equals(this.name, sceneAnnotationSetDataAttributes.name) && + Objects.equals(this.suppliedId, sceneAnnotationSetDataAttributes.suppliedId); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, modifiedAt, name, suppliedId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationSetDataAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("modifiedAt"); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("modifiedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationSetDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationSetDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationSetDataAttributes is not found in the empty JSON string", SceneAnnotationSetDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationSetDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationSetDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationSetDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationSetDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationSetDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationSetDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationSetDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationSetDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationSetDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationSetDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationSetDataAttributes + */ + public static SceneAnnotationSetDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationSetDataAttributes.class); + } + + /** + * Convert an instance of SceneAnnotationSetDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneAnnotationSetList.java b/src/main/java/com/vertexvis/model/SceneAnnotationSetList.java new file mode 100644 index 0000000..22356f5 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneAnnotationSetList.java @@ -0,0 +1,271 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.SceneAnnotationSetData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * SceneAnnotationSetList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneAnnotationSetList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private Map links = new HashMap<>(); + + public SceneAnnotationSetList() { + } + + public SceneAnnotationSetList data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public SceneAnnotationSetList addDataItem(SceneAnnotationSetData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public SceneAnnotationSetList links(@javax.annotation.Nonnull Map links) { + this.links = links; + return this; + } + + public SceneAnnotationSetList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull Map links) { + this.links = links; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SceneAnnotationSetList sceneAnnotationSetList = (SceneAnnotationSetList) o; + return Objects.equals(this.data, sceneAnnotationSetList.data) && + Objects.equals(this.links, sceneAnnotationSetList.links); + } + + @Override + public int hashCode() { + return Objects.hash(data, links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneAnnotationSetList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneAnnotationSetList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneAnnotationSetList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneAnnotationSetList is not found in the empty JSON string", SceneAnnotationSetList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneAnnotationSetList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneAnnotationSetList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneAnnotationSetList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneAnnotationSetData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneAnnotationSetList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneAnnotationSetList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneAnnotationSetList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneAnnotationSetList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneAnnotationSetList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneAnnotationSetList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneAnnotationSetList + * @throws IOException if the JSON string is invalid with respect to SceneAnnotationSetList + */ + public static SceneAnnotationSetList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneAnnotationSetList.class); + } + + /** + * Convert an instance of SceneAnnotationSetList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneData.java b/src/main/java/com/vertexvis/model/SceneData.java index d5bc1a6..7dbcf2d 100644 --- a/src/main/java/com/vertexvis/model/SceneData.java +++ b/src/main/java/com/vertexvis/model/SceneData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneData() { + public SceneData() { } - public SceneData type(String type) { - + public SceneData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneData id(UUID id) { - + public SceneData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneData attributes(SceneDataAttributes attributes) { - + public SceneData attributes(@javax.annotation.Nonnull SceneDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneDataAttributes attributes) { this.attributes = attributes; } - public SceneData links(Map links) { - + public SceneData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public SceneData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneData is not found in the empty JSON string", SceneData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneData + * @throws IOException if the JSON string is invalid with respect to SceneData + */ + public static SceneData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneData.class); + } + + /** + * Convert an instance of SceneData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneDataAttributes.java b/src/main/java/com/vertexvis/model/SceneDataAttributes.java index 1114b18..3d3809c 100644 --- a/src/main/java/com/vertexvis/model/SceneDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneDataAttributes.java @@ -14,281 +14,272 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera; import com.vertexvis.model.Orientation; -import com.vertexvis.model.OrthographicCamera; -import com.vertexvis.model.PerspectiveCamera; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private OneOfPerspectiveCameraOrthographicCamera camera; + @javax.annotation.Nullable + private CreateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_STATE = "state"; @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable private String state; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TREE_ENABLED = "treeEnabled"; @SerializedName(SERIALIZED_NAME_TREE_ENABLED) + @javax.annotation.Nullable private Boolean treeEnabled; public static final String SERIALIZED_NAME_MODIFIED = "modified"; @SerializedName(SERIALIZED_NAME_MODIFIED) + @javax.annotation.Nullable private OffsetDateTime modified; public static final String SERIALIZED_NAME_WORLD_ORIENTATION = "worldOrientation"; @SerializedName(SERIALIZED_NAME_WORLD_ORIENTATION) + @javax.annotation.Nullable private Orientation worldOrientation; public static final String SERIALIZED_NAME_SCENE_ITEM_COUNT = "sceneItemCount"; @SerializedName(SERIALIZED_NAME_SCENE_ITEM_COUNT) + @javax.annotation.Nullable private Integer sceneItemCount; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); - public SceneDataAttributes() { + public SceneDataAttributes() { } - public SceneDataAttributes camera(OneOfPerspectiveCameraOrthographicCamera camera) { - + public SceneDataAttributes camera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public OneOfPerspectiveCameraOrthographicCamera getCamera() { + public CreateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(OneOfPerspectiveCameraOrthographicCamera camera) { + public void setCamera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public SceneDataAttributes state(String state) { - + public SceneDataAttributes state(@javax.annotation.Nullable String state) { this.state = state; return this; } - /** + /** * Get state * @return state - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "draft", value = "") - public String getState() { return state; } - - public void setState(String state) { + public void setState(@javax.annotation.Nullable String state) { this.state = state; } - public SceneDataAttributes created(OffsetDateTime created) { - + public SceneDataAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public SceneDataAttributes suppliedId(String suppliedId) { - + public SceneDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public SceneDataAttributes name(String name) { - + public SceneDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public SceneDataAttributes treeEnabled(Boolean treeEnabled) { - + public SceneDataAttributes treeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; return this; } - /** + /** * Get treeEnabled * @return treeEnabled - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getTreeEnabled() { return treeEnabled; } - - public void setTreeEnabled(Boolean treeEnabled) { + public void setTreeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; } - public SceneDataAttributes modified(OffsetDateTime modified) { - + public SceneDataAttributes modified(@javax.annotation.Nullable OffsetDateTime modified) { this.modified = modified; return this; } - /** + /** * Get modified * @return modified - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getModified() { return modified; } - - public void setModified(OffsetDateTime modified) { + public void setModified(@javax.annotation.Nullable OffsetDateTime modified) { this.modified = modified; } - public SceneDataAttributes worldOrientation(Orientation worldOrientation) { - + public SceneDataAttributes worldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; return this; } - /** + /** * Get worldOrientation * @return worldOrientation - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Orientation getWorldOrientation() { return worldOrientation; } - - public void setWorldOrientation(Orientation worldOrientation) { + public void setWorldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; } - public SceneDataAttributes sceneItemCount(Integer sceneItemCount) { - + public SceneDataAttributes sceneItemCount(@javax.annotation.Nullable Integer sceneItemCount) { this.sceneItemCount = sceneItemCount; return this; } - /** + /** * The number of scene items in this scene. (This field needs to be explicitly requested) * @return sceneItemCount - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "100", value = "The number of scene items in this scene. (This field needs to be explicitly requested)") - public Integer getSceneItemCount() { return sceneItemCount; } - - public void setSceneItemCount(Integer sceneItemCount) { + public void setSceneItemCount(@javax.annotation.Nullable Integer sceneItemCount) { this.sceneItemCount = sceneItemCount; } - public SceneDataAttributes metadata(Map metadata) { - + public SceneDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } @@ -301,23 +292,21 @@ public SceneDataAttributes putMetadataItem(String key, String metadataItem) { return this; } - /** + /** * User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. ") - public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } + @Override public boolean equals(Object o) { if (this == o) { @@ -339,22 +328,11 @@ public boolean equals(Object o) { Objects.equals(this.metadata, sceneDataAttributes.metadata); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(camera, state, created, suppliedId, name, treeEnabled, modified, worldOrientation, sceneItemCount, metadata); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -384,5 +362,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("state"); + openapiFields.add("created"); + openapiFields.add("suppliedId"); + openapiFields.add("name"); + openapiFields.add("treeEnabled"); + openapiFields.add("modified"); + openapiFields.add("worldOrientation"); + openapiFields.add("sceneItemCount"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneDataAttributes is not found in the empty JSON string", SceneDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + CreateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `worldOrientation` + if (jsonObj.get("worldOrientation") != null && !jsonObj.get("worldOrientation").isJsonNull()) { + Orientation.validateJsonElement(jsonObj.get("worldOrientation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneDataAttributes + */ + public static SceneDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneDataAttributes.class); + } + + /** + * Convert an instance of SceneDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItem.java b/src/main/java/com/vertexvis/model/SceneItem.java index e241d87..fe8944e 100644 --- a/src/main/java/com/vertexvis/model/SceneItem.java +++ b/src/main/java/com/vertexvis/model/SceneItem.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItem { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneItemData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneItem() { + public SceneItem() { } - public SceneItem data(SceneItemData data) { - + public SceneItem data(@javax.annotation.Nonnull SceneItemData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemData getData() { return data; } - - public void setData(SceneItemData data) { + public void setData(@javax.annotation.Nonnull SceneItemData data) { this.data = data; } - public SceneItem links(Map links) { - + public SceneItem links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneItem putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItem is not found in the empty JSON string", SceneItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneItemData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItem + * @throws IOException if the JSON string is invalid with respect to SceneItem + */ + public static SceneItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItem.class); + } + + /** + * Convert an instance of SceneItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemData.java b/src/main/java/com/vertexvis/model/SceneItemData.java index 870d28d..a55b307 100644 --- a/src/main/java/com/vertexvis/model/SceneItemData.java +++ b/src/main/java/com/vertexvis/model/SceneItemData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemDataAttributes; import com.vertexvis.model.SceneItemDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneItemData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneItemDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneItemDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneItemData() { + public SceneItemData() { } - public SceneItemData type(String type) { - + public SceneItemData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneItemData id(UUID id) { - + public SceneItemData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneItemData attributes(SceneItemDataAttributes attributes) { - + public SceneItemData attributes(@javax.annotation.Nonnull SceneItemDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneItemDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneItemDataAttributes attributes) { this.attributes = attributes; } - public SceneItemData relationships(SceneItemDataRelationships relationships) { - + public SceneItemData relationships(@javax.annotation.Nonnull SceneItemDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneItemDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneItemDataRelationships relationships) { this.relationships = relationships; } - public SceneItemData links(Map links) { - + public SceneItemData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public SceneItemData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemData is not found in the empty JSON string", SceneItemData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneItemDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneItemDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemData + * @throws IOException if the JSON string is invalid with respect to SceneItemData + */ + public static SceneItemData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemData.class); + } + + /** + * Convert an instance of SceneItemData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java b/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java index 99b2c09..b5dec0b 100644 --- a/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java @@ -14,175 +14,189 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; import com.vertexvis.model.BoundingBox; import com.vertexvis.model.ColorMaterial; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItemDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemDataAttributes { public static final String SERIALIZED_NAME_BOUNDING_BOX = "boundingBox"; @SerializedName(SERIALIZED_NAME_BOUNDING_BOX) + @javax.annotation.Nullable private BoundingBox boundingBox; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; public static final String SERIALIZED_NAME_MATERIAL_OVERRIDE = "materialOverride"; @SerializedName(SERIALIZED_NAME_MATERIAL_OVERRIDE) + @javax.annotation.Nullable private ColorMaterial materialOverride; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_WORLD_TRANSFORM = "worldTransform"; @SerializedName(SERIALIZED_NAME_WORLD_TRANSFORM) + @javax.annotation.Nullable private Matrix4 worldTransform; - public SceneItemDataAttributes() { + public SceneItemDataAttributes() { } - public SceneItemDataAttributes boundingBox(BoundingBox boundingBox) { - + public SceneItemDataAttributes boundingBox(@javax.annotation.Nullable BoundingBox boundingBox) { this.boundingBox = boundingBox; return this; } - /** + /** * Get boundingBox * @return boundingBox - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public BoundingBox getBoundingBox() { return boundingBox; } - - public void setBoundingBox(BoundingBox boundingBox) { + public void setBoundingBox(@javax.annotation.Nullable BoundingBox boundingBox) { this.boundingBox = boundingBox; } - public SceneItemDataAttributes created(OffsetDateTime created) { - + public SceneItemDataAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public SceneItemDataAttributes endItem(Boolean endItem) { - + public SceneItemDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Get endItem * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } - public SceneItemDataAttributes materialOverride(ColorMaterial materialOverride) { - + public SceneItemDataAttributes materialOverride(@javax.annotation.Nullable ColorMaterial materialOverride) { this.materialOverride = materialOverride; return this; } - /** + /** * Get materialOverride * @return materialOverride - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterial getMaterialOverride() { return materialOverride; } - - public void setMaterialOverride(ColorMaterial materialOverride) { + public void setMaterialOverride(@javax.annotation.Nullable ColorMaterial materialOverride) { this.materialOverride = materialOverride; } - public SceneItemDataAttributes metadata(Map metadata) { - + public SceneItemDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public SceneItemDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public SceneItemDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -190,161 +204,135 @@ public SceneItemDataAttributes putMetadataItem(String key, AnyOfMetadataLongType return this; } - /** + /** * Get metadata * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } - public SceneItemDataAttributes name(String name) { - + public SceneItemDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public SceneItemDataAttributes phantom(Boolean phantom) { - + public SceneItemDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Get phantom * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public SceneItemDataAttributes suppliedId(String suppliedId) { - + public SceneItemDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public SceneItemDataAttributes transform(Matrix4 transform) { - + public SceneItemDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } - public SceneItemDataAttributes visible(Boolean visible) { - + public SceneItemDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Get visible * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public SceneItemDataAttributes worldTransform(Matrix4 worldTransform) { - + public SceneItemDataAttributes worldTransform(@javax.annotation.Nullable Matrix4 worldTransform) { this.worldTransform = worldTransform; return this; } - /** + /** * Get worldTransform * @return worldTransform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getWorldTransform() { return worldTransform; } - - public void setWorldTransform(Matrix4 worldTransform) { + public void setWorldTransform(@javax.annotation.Nullable Matrix4 worldTransform) { this.worldTransform = worldTransform; } + @Override public boolean equals(Object o) { if (this == o) { @@ -402,5 +390,121 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("boundingBox"); + openapiFields.add("created"); + openapiFields.add("endItem"); + openapiFields.add("materialOverride"); + openapiFields.add("metadata"); + openapiFields.add("name"); + openapiFields.add("phantom"); + openapiFields.add("suppliedId"); + openapiFields.add("transform"); + openapiFields.add("visible"); + openapiFields.add("worldTransform"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemDataAttributes is not found in the empty JSON string", SceneItemDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `boundingBox` + if (jsonObj.get("boundingBox") != null && !jsonObj.get("boundingBox").isJsonNull()) { + BoundingBox.validateJsonElement(jsonObj.get("boundingBox")); + } + // validate the optional field `materialOverride` + if (jsonObj.get("materialOverride") != null && !jsonObj.get("materialOverride").isJsonNull()) { + ColorMaterial.validateJsonElement(jsonObj.get("materialOverride")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + // validate the optional field `worldTransform` + if (jsonObj.get("worldTransform") != null && !jsonObj.get("worldTransform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("worldTransform")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneItemDataAttributes + */ + public static SceneItemDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemDataAttributes.class); + } + + /** + * Convert an instance of SceneItemDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemDataRelationships.java b/src/main/java/com/vertexvis/model/SceneItemDataRelationships.java index 7db33d1..f04b867 100644 --- a/src/main/java/com/vertexvis/model/SceneItemDataRelationships.java +++ b/src/main/java/com/vertexvis/model/SceneItemDataRelationships.java @@ -14,108 +14,121 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PartRenditionRelationship; +import com.vertexvis.model.SceneItemDataRelationshipsSource; import com.vertexvis.model.SceneItemRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItemDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) - private AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source; + @javax.annotation.Nullable + private SceneItemDataRelationshipsSource source; public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable private SceneItemRelationship parent; public static final String SERIALIZED_NAME_PART_RENDITION = "partRendition"; @SerializedName(SERIALIZED_NAME_PART_RENDITION) + @javax.annotation.Nullable private PartRenditionRelationship partRendition; - public SceneItemDataRelationships() { + public SceneItemDataRelationships() { } - public SceneItemDataRelationships source(AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source) { - + public SceneItemDataRelationships source(@javax.annotation.Nullable SceneItemDataRelationshipsSource source) { this.source = source; return this; } - /** + /** * Get source * @return source - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship getSource() { + public SceneItemDataRelationshipsSource getSource() { return source; } - - public void setSource(AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship source) { + public void setSource(@javax.annotation.Nullable SceneItemDataRelationshipsSource source) { this.source = source; } - public SceneItemDataRelationships parent(SceneItemRelationship parent) { - + public SceneItemDataRelationships parent(@javax.annotation.Nullable SceneItemRelationship parent) { this.parent = parent; return this; } - /** + /** * Get parent * @return parent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public SceneItemRelationship getParent() { return parent; } - - public void setParent(SceneItemRelationship parent) { + public void setParent(@javax.annotation.Nullable SceneItemRelationship parent) { this.parent = parent; } - public SceneItemDataRelationships partRendition(PartRenditionRelationship partRendition) { - + public SceneItemDataRelationships partRendition(@javax.annotation.Nullable PartRenditionRelationship partRendition) { this.partRendition = partRendition; return this; } - /** + /** * Get partRendition * @return partRendition - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PartRenditionRelationship getPartRendition() { return partRendition; } - - public void setPartRendition(PartRenditionRelationship partRendition) { + public void setPartRendition(@javax.annotation.Nullable PartRenditionRelationship partRendition) { this.partRendition = partRendition; } + @Override public boolean equals(Object o) { if (this == o) { @@ -130,22 +143,11 @@ public boolean equals(Object o) { Objects.equals(this.partRendition, sceneItemDataRelationships.partRendition); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(source, parent, partRendition); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -168,5 +170,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + openapiFields.add("parent"); + openapiFields.add("partRendition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemDataRelationships is not found in the empty JSON string", SceneItemDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + SceneItemDataRelationshipsSource.validateJsonElement(jsonObj.get("source")); + } + // validate the optional field `parent` + if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { + SceneItemRelationship.validateJsonElement(jsonObj.get("parent")); + } + // validate the optional field `partRendition` + if (jsonObj.get("partRendition") != null && !jsonObj.get("partRendition").isJsonNull()) { + PartRenditionRelationship.validateJsonElement(jsonObj.get("partRendition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemDataRelationships + * @throws IOException if the JSON string is invalid with respect to SceneItemDataRelationships + */ + public static SceneItemDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemDataRelationships.class); + } + + /** + * Convert an instance of SceneItemDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/SceneItemDataRelationshipsSource.java new file mode 100644 index 0000000..16cd89f --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneItemDataRelationshipsSource.java @@ -0,0 +1,360 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.GeometrySetRelationship; +import com.vertexvis.model.PartRenditionRelationship; +import com.vertexvis.model.PartRenditionRelationshipData; +import com.vertexvis.model.PartRevisionRelationship; +import com.vertexvis.model.SceneRelationship; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneItemDataRelationshipsSource extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SceneItemDataRelationshipsSource.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemDataRelationshipsSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemDataRelationshipsSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterGeometrySetRelationship = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetRelationship.class)); + final TypeAdapter adapterPartRevisionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionRelationship.class)); + final TypeAdapter adapterSceneRelationship = gson.getDelegateAdapter(this, TypeToken.get(SceneRelationship.class)); + final TypeAdapter adapterPartRenditionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRenditionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemDataRelationshipsSource value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `GeometrySetRelationship` + if (value.getActualInstance() instanceof GeometrySetRelationship) { + JsonElement element = adapterGeometrySetRelationship.toJsonTree((GeometrySetRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionRelationship` + if (value.getActualInstance() instanceof PartRevisionRelationship) { + JsonElement element = adapterPartRevisionRelationship.toJsonTree((PartRevisionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneRelationship` + if (value.getActualInstance() instanceof SceneRelationship) { + JsonElement element = adapterSceneRelationship.toJsonTree((SceneRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRenditionRelationship` + if (value.getActualInstance() instanceof PartRenditionRelationship) { + JsonElement element = adapterPartRenditionRelationship.toJsonTree((PartRenditionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship"); + } + + @Override + public SceneItemDataRelationshipsSource read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GeometrySetRelationship + try { + // validate the JSON object to see if any exception is thrown + GeometrySetRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterGeometrySetRelationship; + SceneItemDataRelationshipsSource ret = new SceneItemDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'GeometrySetRelationship'", e); + } + // deserialize PartRevisionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRevisionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionRelationship; + SceneItemDataRelationshipsSource ret = new SceneItemDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionRelationship'", e); + } + // deserialize SceneRelationship + try { + // validate the JSON object to see if any exception is thrown + SceneRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterSceneRelationship; + SceneItemDataRelationshipsSource ret = new SceneItemDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneRelationship'", e); + } + // deserialize PartRenditionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRenditionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRenditionRelationship; + SceneItemDataRelationshipsSource ret = new SceneItemDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRenditionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRenditionRelationship'", e); + } + + throw new IOException(String.format("Failed deserialization for SceneItemDataRelationshipsSource: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public SceneItemDataRelationshipsSource() { + super("anyOf", Boolean.FALSE); + } + + public SceneItemDataRelationshipsSource(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeometrySetRelationship", GeometrySetRelationship.class); + schemas.put("PartRevisionRelationship", PartRevisionRelationship.class); + schemas.put("SceneRelationship", SceneRelationship.class); + schemas.put("PartRenditionRelationship", PartRenditionRelationship.class); + } + + @Override + public Map> getSchemas() { + return SceneItemDataRelationshipsSource.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GeometrySetRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRenditionRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship + * + * @return The actual instance (GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeometrySetRelationship`. If the actual instance is not `GeometrySetRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GeometrySetRelationship` + * @throws ClassCastException if the instance is not `GeometrySetRelationship` + */ + public GeometrySetRelationship getGeometrySetRelationship() throws ClassCastException { + return (GeometrySetRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionRelationship`. If the actual instance is not `PartRevisionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionRelationship` + * @throws ClassCastException if the instance is not `PartRevisionRelationship` + */ + public PartRevisionRelationship getPartRevisionRelationship() throws ClassCastException { + return (PartRevisionRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneRelationship`. If the actual instance is not `SceneRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneRelationship` + * @throws ClassCastException if the instance is not `SceneRelationship` + */ + public SceneRelationship getSceneRelationship() throws ClassCastException { + return (SceneRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRenditionRelationship`. If the actual instance is not `PartRenditionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRenditionRelationship` + * @throws ClassCastException if the instance is not `PartRenditionRelationship` + */ + public PartRenditionRelationship getPartRenditionRelationship() throws ClassCastException { + return (PartRenditionRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemDataRelationshipsSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GeometrySetRelationship + try { + GeometrySetRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionRelationship + try { + PartRevisionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneRelationship + try { + SceneRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRenditionRelationship + try { + PartRenditionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRenditionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for SceneItemDataRelationshipsSource with anyOf schemas: GeometrySetRelationship, PartRenditionRelationship, PartRevisionRelationship, SceneRelationship. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of SceneItemDataRelationshipsSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemDataRelationshipsSource + * @throws IOException if the JSON string is invalid with respect to SceneItemDataRelationshipsSource + */ + public static SceneItemDataRelationshipsSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemDataRelationshipsSource.class); + } + + /** + * Convert an instance of SceneItemDataRelationshipsSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneItemList.java b/src/main/java/com/vertexvis/model/SceneItemList.java index 8b925ab..0fcc46f 100644 --- a/src/main/java/com/vertexvis/model/SceneItemList.java +++ b/src/main/java/com/vertexvis/model/SceneItemList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneItemList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneItemList() { + public SceneItemList() { } - public SceneItemList data(List data) { - + public SceneItemList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneItemList addDataItem(SceneItemData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneItemList links(Map links) { - + public SceneItemList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneItemList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemList is not found in the empty JSON string", SceneItemList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneItemData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemList + * @throws IOException if the JSON string is invalid with respect to SceneItemList + */ + public static SceneItemList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemList.class); + } + + /** + * Convert an instance of SceneItemList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemOverride.java b/src/main/java/com/vertexvis/model/SceneItemOverride.java index df178e6..854b689 100644 --- a/src/main/java/com/vertexvis/model/SceneItemOverride.java +++ b/src/main/java/com/vertexvis/model/SceneItemOverride.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemOverrideData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItemOverride */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemOverride { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneItemOverrideData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneItemOverride() { + public SceneItemOverride() { } - public SceneItemOverride data(SceneItemOverrideData data) { - + public SceneItemOverride data(@javax.annotation.Nonnull SceneItemOverrideData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemOverrideData getData() { return data; } - - public void setData(SceneItemOverrideData data) { + public void setData(@javax.annotation.Nonnull SceneItemOverrideData data) { this.data = data; } - public SceneItemOverride links(Map links) { - + public SceneItemOverride links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneItemOverride putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemOverride + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemOverride.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemOverride is not found in the empty JSON string", SceneItemOverride.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemOverride.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemOverride` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemOverride.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneItemOverrideData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemOverride.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemOverride' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemOverride.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemOverride value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemOverride read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemOverride given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemOverride + * @throws IOException if the JSON string is invalid with respect to SceneItemOverride + */ + public static SceneItemOverride fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemOverride.class); + } + + /** + * Convert an instance of SceneItemOverride to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemOverrideData.java b/src/main/java/com/vertexvis/model/SceneItemOverrideData.java index 7028fb0..45c4f01 100644 --- a/src/main/java/com/vertexvis/model/SceneItemOverrideData.java +++ b/src/main/java/com/vertexvis/model/SceneItemOverrideData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemOverrideDataAttributes; import com.vertexvis.model.SceneItemOverrideDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneItemOverrideData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemOverrideData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneItemOverrideDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneItemOverrideDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneItemOverrideData() { + public SceneItemOverrideData() { } - public SceneItemOverrideData type(String type) { - + public SceneItemOverrideData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item-override", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneItemOverrideData id(UUID id) { - + public SceneItemOverrideData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneItemOverrideData attributes(SceneItemOverrideDataAttributes attributes) { - + public SceneItemOverrideData attributes(@javax.annotation.Nonnull SceneItemOverrideDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemOverrideDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneItemOverrideDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneItemOverrideDataAttributes attributes) { this.attributes = attributes; } - public SceneItemOverrideData relationships(SceneItemOverrideDataRelationships relationships) { - + public SceneItemOverrideData relationships(@javax.annotation.Nonnull SceneItemOverrideDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemOverrideDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneItemOverrideDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneItemOverrideDataRelationships relationships) { this.relationships = relationships; } - public SceneItemOverrideData links(Map links) { - + public SceneItemOverrideData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public SceneItemOverrideData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemOverrideData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemOverrideData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemOverrideData is not found in the empty JSON string", SceneItemOverrideData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemOverrideData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemOverrideData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemOverrideData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneItemOverrideDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneItemOverrideDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemOverrideData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemOverrideData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemOverrideData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemOverrideData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemOverrideData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemOverrideData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemOverrideData + * @throws IOException if the JSON string is invalid with respect to SceneItemOverrideData + */ + public static SceneItemOverrideData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemOverrideData.class); + } + + /** + * Convert an instance of SceneItemOverrideData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemOverrideDataAttributes.java b/src/main/java/com/vertexvis/model/SceneItemOverrideDataAttributes.java index 5cc7a49..a5c228d 100644 --- a/src/main/java/com/vertexvis/model/SceneItemOverrideDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneItemOverrideDataAttributes.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,208 +21,210 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterial; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItemOverrideDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemOverrideDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; public static final String SERIALIZED_NAME_MATERIAL = "material"; @SerializedName(SERIALIZED_NAME_MATERIAL) + @javax.annotation.Nullable private ColorMaterial material; public static final String SERIALIZED_NAME_SELECTED = "selected"; @SerializedName(SERIALIZED_NAME_SELECTED) + @javax.annotation.Nullable private Boolean selected; public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; - public SceneItemOverrideDataAttributes() { + public SceneItemOverrideDataAttributes() { } - public SceneItemOverrideDataAttributes created(OffsetDateTime created) { - + public SceneItemOverrideDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public SceneItemOverrideDataAttributes visible(Boolean visible) { - + public SceneItemOverrideDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Get visible * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public SceneItemOverrideDataAttributes transform(Matrix4 transform) { - + public SceneItemOverrideDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } - public SceneItemOverrideDataAttributes material(ColorMaterial material) { - + public SceneItemOverrideDataAttributes material(@javax.annotation.Nullable ColorMaterial material) { this.material = material; return this; } - /** + /** * Get material * @return material - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterial getMaterial() { return material; } - - public void setMaterial(ColorMaterial material) { + public void setMaterial(@javax.annotation.Nullable ColorMaterial material) { this.material = material; } - public SceneItemOverrideDataAttributes selected(Boolean selected) { - + public SceneItemOverrideDataAttributes selected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; return this; } - /** + /** * Get selected * @return selected - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getSelected() { return selected; } - - public void setSelected(Boolean selected) { + public void setSelected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; } - public SceneItemOverrideDataAttributes phantom(Boolean phantom) { - + public SceneItemOverrideDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Get phantom * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public SceneItemOverrideDataAttributes endItem(Boolean endItem) { - + public SceneItemOverrideDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Get endItem * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -273,5 +274,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("visible"); + openapiFields.add("transform"); + openapiFields.add("material"); + openapiFields.add("selected"); + openapiFields.add("phantom"); + openapiFields.add("endItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemOverrideDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemOverrideDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemOverrideDataAttributes is not found in the empty JSON string", SceneItemOverrideDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemOverrideDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemOverrideDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemOverrideDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + // validate the optional field `material` + if (jsonObj.get("material") != null && !jsonObj.get("material").isJsonNull()) { + ColorMaterial.validateJsonElement(jsonObj.get("material")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemOverrideDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemOverrideDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemOverrideDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemOverrideDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemOverrideDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemOverrideDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemOverrideDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneItemOverrideDataAttributes + */ + public static SceneItemOverrideDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemOverrideDataAttributes.class); + } + + /** + * Convert an instance of SceneItemOverrideDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemOverrideDataRelationships.java b/src/main/java/com/vertexvis/model/SceneItemOverrideDataRelationships.java index 2a767c4..9b36083 100644 --- a/src/main/java/com/vertexvis/model/SceneItemOverrideDataRelationships.java +++ b/src/main/java/com/vertexvis/model/SceneItemOverrideDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneItemRelationship; import com.vertexvis.model.SceneViewRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneItemOverrideDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemOverrideDataRelationships { public static final String SERIALIZED_NAME_SCENE_ITEM = "sceneItem"; @SerializedName(SERIALIZED_NAME_SCENE_ITEM) + @javax.annotation.Nonnull private SceneItemRelationship sceneItem; public static final String SERIALIZED_NAME_SCENE_VIEW = "sceneView"; @SerializedName(SERIALIZED_NAME_SCENE_VIEW) + @javax.annotation.Nonnull private SceneViewRelationship sceneView; - public SceneItemOverrideDataRelationships() { + public SceneItemOverrideDataRelationships() { } - public SceneItemOverrideDataRelationships sceneItem(SceneItemRelationship sceneItem) { - + public SceneItemOverrideDataRelationships sceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; return this; } - /** + /** * Get sceneItem * @return sceneItem - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemRelationship getSceneItem() { return sceneItem; } - - public void setSceneItem(SceneItemRelationship sceneItem) { + public void setSceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; } - public SceneItemOverrideDataRelationships sceneView(SceneViewRelationship sceneView) { - + public SceneItemOverrideDataRelationships sceneView(@javax.annotation.Nonnull SceneViewRelationship sceneView) { this.sceneView = sceneView; return this; } - /** + /** * Get sceneView * @return sceneView - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewRelationship getSceneView() { return sceneView; } - - public void setSceneView(SceneViewRelationship sceneView) { + public void setSceneView(@javax.annotation.Nonnull SceneViewRelationship sceneView) { this.sceneView = sceneView; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sceneItem"); + openapiFields.add("sceneView"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sceneItem"); + openapiRequiredFields.add("sceneView"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemOverrideDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemOverrideDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemOverrideDataRelationships is not found in the empty JSON string", SceneItemOverrideDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemOverrideDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemOverrideDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemOverrideDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `sceneItem` + SceneItemRelationship.validateJsonElement(jsonObj.get("sceneItem")); + // validate the required field `sceneView` + SceneViewRelationship.validateJsonElement(jsonObj.get("sceneView")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemOverrideDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemOverrideDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemOverrideDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemOverrideDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemOverrideDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemOverrideDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemOverrideDataRelationships + * @throws IOException if the JSON string is invalid with respect to SceneItemOverrideDataRelationships + */ + public static SceneItemOverrideDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemOverrideDataRelationships.class); + } + + /** + * Convert an instance of SceneItemOverrideDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemOverrideList.java b/src/main/java/com/vertexvis/model/SceneItemOverrideList.java index dbd0b54..945f302 100644 --- a/src/main/java/com/vertexvis/model/SceneItemOverrideList.java +++ b/src/main/java/com/vertexvis/model/SceneItemOverrideList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemOverrideData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneItemOverrideList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemOverrideList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneItemOverrideList() { + public SceneItemOverrideList() { } - public SceneItemOverrideList data(List data) { - + public SceneItemOverrideList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneItemOverrideList addDataItem(SceneItemOverrideData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneItemOverrideList links(Map links) { - + public SceneItemOverrideList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneItemOverrideList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemOverrideList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemOverrideList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemOverrideList is not found in the empty JSON string", SceneItemOverrideList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemOverrideList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemOverrideList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemOverrideList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneItemOverrideData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemOverrideList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemOverrideList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemOverrideList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemOverrideList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemOverrideList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemOverrideList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemOverrideList + * @throws IOException if the JSON string is invalid with respect to SceneItemOverrideList + */ + public static SceneItemOverrideList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemOverrideList.class); + } + + /** + * Convert an instance of SceneItemOverrideList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemRelationship.java b/src/main/java/com/vertexvis/model/SceneItemRelationship.java index be63834..fd14783 100644 --- a/src/main/java/com/vertexvis/model/SceneItemRelationship.java +++ b/src/main/java/com/vertexvis/model/SceneItemRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneItemRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `scene-item`. */ -@ApiModel(description = "Relationship to a `scene-item`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneItemRelationshipData data; - public SceneItemRelationship() { + public SceneItemRelationship() { } - public SceneItemRelationship data(SceneItemRelationshipData data) { - + public SceneItemRelationship data(@javax.annotation.Nonnull SceneItemRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemRelationshipData getData() { return data; } - - public void setData(SceneItemRelationshipData data) { + public void setData(@javax.annotation.Nonnull SceneItemRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemRelationship is not found in the empty JSON string", SceneItemRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneItemRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemRelationship + * @throws IOException if the JSON string is invalid with respect to SceneItemRelationship + */ + public static SceneItemRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemRelationship.class); + } + + /** + * Convert an instance of SceneItemRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneItemRelationshipData.java b/src/main/java/com/vertexvis/model/SceneItemRelationshipData.java index b26b8fd..a4719f9 100644 --- a/src/main/java/com/vertexvis/model/SceneItemRelationshipData.java +++ b/src/main/java/com/vertexvis/model/SceneItemRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneItemRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneItemRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public SceneItemRelationshipData() { + public SceneItemRelationshipData() { } - public SceneItemRelationshipData type(TypeEnum type) { - + public SceneItemRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public SceneItemRelationshipData id(UUID id) { - + public SceneItemRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneItemRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneItemRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneItemRelationshipData is not found in the empty JSON string", SceneItemRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneItemRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneItemRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneItemRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneItemRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneItemRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneItemRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneItemRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneItemRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneItemRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneItemRelationshipData + * @throws IOException if the JSON string is invalid with respect to SceneItemRelationshipData + */ + public static SceneItemRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneItemRelationshipData.class); + } + + /** + * Convert an instance of SceneItemRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneList.java b/src/main/java/com/vertexvis/model/SceneList.java index 895c1e3..992ab48 100644 --- a/src/main/java/com/vertexvis/model/SceneList.java +++ b/src/main/java/com/vertexvis/model/SceneList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneList() { + public SceneList() { } - public SceneList data(List data) { - + public SceneList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneList addDataItem(SceneData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneList links(Map links) { - + public SceneList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneList is not found in the empty JSON string", SceneList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneList + * @throws IOException if the JSON string is invalid with respect to SceneList + */ + public static SceneList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneList.class); + } + + /** + * Convert an instance of SceneList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneOperation.java b/src/main/java/com/vertexvis/model/SceneOperation.java index add4553..ae89937 100644 --- a/src/main/java/com/vertexvis/model/SceneOperation.java +++ b/src/main/java/com/vertexvis/model/SceneOperation.java @@ -14,86 +14,106 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.SceneOperationOperationsInner; +import com.vertexvis.model.SceneOperationQuery; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneOperation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneOperation { public static final String SERIALIZED_NAME_QUERY = "query"; @SerializedName(SERIALIZED_NAME_QUERY) - private AnyOfQueryByIdQueryByCollectionQueryAll query; + @javax.annotation.Nonnull + private SceneOperationQuery query; public static final String SERIALIZED_NAME_OPERATIONS = "operations"; @SerializedName(SERIALIZED_NAME_OPERATIONS) - private List operations = new ArrayList<>(); + @javax.annotation.Nonnull + private List operations = new ArrayList<>(); - public SceneOperation() { + public SceneOperation() { } - public SceneOperation query(AnyOfQueryByIdQueryByCollectionQueryAll query) { - + public SceneOperation query(@javax.annotation.Nonnull SceneOperationQuery query) { this.query = query; return this; } - /** - * Query `scene-items`. Use `query-by-collection` to combine multiple queries. + /** + * Get query * @return query - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "Query `scene-items`. Use `query-by-collection` to combine multiple queries.") - - public AnyOfQueryByIdQueryByCollectionQueryAll getQuery() { + */ + @javax.annotation.Nonnull + public SceneOperationQuery getQuery() { return query; } - - public void setQuery(AnyOfQueryByIdQueryByCollectionQueryAll query) { + public void setQuery(@javax.annotation.Nonnull SceneOperationQuery query) { this.query = query; } - public SceneOperation operations(List operations) { - + public SceneOperation operations(@javax.annotation.Nonnull List operations) { this.operations = operations; return this; } - public SceneOperation addOperationsItem(AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp operationsItem) { + public SceneOperation addOperationsItem(SceneOperationOperationsInner operationsItem) { + if (this.operations == null) { + this.operations = new ArrayList<>(); + } this.operations.add(operationsItem); return this; } - /** + /** * List of operations to perform on `scene-items` matching the query. * @return operations - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "List of operations to perform on `scene-items` matching the query.") - - public List getOperations() { + public List getOperations() { return operations; } - - public void setOperations(List operations) { + public void setOperations(@javax.annotation.Nonnull List operations) { this.operations = operations; } + @Override public boolean equals(Object o) { if (this == o) { @@ -133,5 +153,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + openapiFields.add("operations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("query"); + openapiRequiredFields.add("operations"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneOperation is not found in the empty JSON string", SceneOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `query` + SceneOperationQuery.validateJsonElement(jsonObj.get("query")); + // ensure the json data is an array + if (!jsonObj.get("operations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `operations` to be an array in the JSON string but got `%s`", jsonObj.get("operations").toString())); + } + + JsonArray jsonArrayoperations = jsonObj.getAsJsonArray("operations"); + // validate the required field `operations` (array) + for (int i = 0; i < jsonArrayoperations.size(); i++) { + SceneOperationOperationsInner.validateJsonElement(jsonArrayoperations.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneOperation + * @throws IOException if the JSON string is invalid with respect to SceneOperation + */ + public static SceneOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneOperation.class); + } + + /** + * Convert an instance of SceneOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneOperationOperationsInner.java b/src/main/java/com/vertexvis/model/SceneOperationOperationsInner.java new file mode 100644 index 0000000..84f4a5f --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneOperationOperationsInner.java @@ -0,0 +1,822 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.ChangeMaterialOp; +import com.vertexvis.model.ChangeTransformOp; +import com.vertexvis.model.ChangeVisibilityOp; +import com.vertexvis.model.ClearMaterialOp; +import com.vertexvis.model.ClearRenOp; +import com.vertexvis.model.ClearRepOp; +import com.vertexvis.model.ClearTransformOp; +import com.vertexvis.model.ColorMaterial; +import com.vertexvis.model.DeselectOperation; +import com.vertexvis.model.Matrix4; +import com.vertexvis.model.SelectOp; +import com.vertexvis.model.ViewDefaultRenOp; +import com.vertexvis.model.ViewRenByIdOp; +import com.vertexvis.model.ViewRenBySuppliedIdOp; +import com.vertexvis.model.ViewRepByIdOp; +import com.vertexvis.model.ViewRepByPredefinedIdOp; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneOperationOperationsInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SceneOperationOperationsInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneOperationOperationsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneOperationOperationsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterChangeVisibilityOp = gson.getDelegateAdapter(this, TypeToken.get(ChangeVisibilityOp.class)); + final TypeAdapter adapterChangeMaterialOp = gson.getDelegateAdapter(this, TypeToken.get(ChangeMaterialOp.class)); + final TypeAdapter adapterClearMaterialOp = gson.getDelegateAdapter(this, TypeToken.get(ClearMaterialOp.class)); + final TypeAdapter adapterChangeTransformOp = gson.getDelegateAdapter(this, TypeToken.get(ChangeTransformOp.class)); + final TypeAdapter adapterClearTransformOp = gson.getDelegateAdapter(this, TypeToken.get(ClearTransformOp.class)); + final TypeAdapter adapterSelectOp = gson.getDelegateAdapter(this, TypeToken.get(SelectOp.class)); + final TypeAdapter adapterDeselectOperation = gson.getDelegateAdapter(this, TypeToken.get(DeselectOperation.class)); + final TypeAdapter adapterClearRenOp = gson.getDelegateAdapter(this, TypeToken.get(ClearRenOp.class)); + final TypeAdapter adapterViewDefaultRenOp = gson.getDelegateAdapter(this, TypeToken.get(ViewDefaultRenOp.class)); + final TypeAdapter adapterViewRenByIdOp = gson.getDelegateAdapter(this, TypeToken.get(ViewRenByIdOp.class)); + final TypeAdapter adapterViewRenBySuppliedIdOp = gson.getDelegateAdapter(this, TypeToken.get(ViewRenBySuppliedIdOp.class)); + final TypeAdapter adapterViewRepByIdOp = gson.getDelegateAdapter(this, TypeToken.get(ViewRepByIdOp.class)); + final TypeAdapter adapterViewRepByPredefinedIdOp = gson.getDelegateAdapter(this, TypeToken.get(ViewRepByPredefinedIdOp.class)); + final TypeAdapter adapterClearRepOp = gson.getDelegateAdapter(this, TypeToken.get(ClearRepOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneOperationOperationsInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `ChangeVisibilityOp` + if (value.getActualInstance() instanceof ChangeVisibilityOp) { + JsonElement element = adapterChangeVisibilityOp.toJsonTree((ChangeVisibilityOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ChangeMaterialOp` + if (value.getActualInstance() instanceof ChangeMaterialOp) { + JsonElement element = adapterChangeMaterialOp.toJsonTree((ChangeMaterialOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ClearMaterialOp` + if (value.getActualInstance() instanceof ClearMaterialOp) { + JsonElement element = adapterClearMaterialOp.toJsonTree((ClearMaterialOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ChangeTransformOp` + if (value.getActualInstance() instanceof ChangeTransformOp) { + JsonElement element = adapterChangeTransformOp.toJsonTree((ChangeTransformOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ClearTransformOp` + if (value.getActualInstance() instanceof ClearTransformOp) { + JsonElement element = adapterClearTransformOp.toJsonTree((ClearTransformOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SelectOp` + if (value.getActualInstance() instanceof SelectOp) { + JsonElement element = adapterSelectOp.toJsonTree((SelectOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `DeselectOperation` + if (value.getActualInstance() instanceof DeselectOperation) { + JsonElement element = adapterDeselectOperation.toJsonTree((DeselectOperation)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ClearRenOp` + if (value.getActualInstance() instanceof ClearRenOp) { + JsonElement element = adapterClearRenOp.toJsonTree((ClearRenOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ViewDefaultRenOp` + if (value.getActualInstance() instanceof ViewDefaultRenOp) { + JsonElement element = adapterViewDefaultRenOp.toJsonTree((ViewDefaultRenOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ViewRenByIdOp` + if (value.getActualInstance() instanceof ViewRenByIdOp) { + JsonElement element = adapterViewRenByIdOp.toJsonTree((ViewRenByIdOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ViewRenBySuppliedIdOp` + if (value.getActualInstance() instanceof ViewRenBySuppliedIdOp) { + JsonElement element = adapterViewRenBySuppliedIdOp.toJsonTree((ViewRenBySuppliedIdOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ViewRepByIdOp` + if (value.getActualInstance() instanceof ViewRepByIdOp) { + JsonElement element = adapterViewRepByIdOp.toJsonTree((ViewRepByIdOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ViewRepByPredefinedIdOp` + if (value.getActualInstance() instanceof ViewRepByPredefinedIdOp) { + JsonElement element = adapterViewRepByPredefinedIdOp.toJsonTree((ViewRepByPredefinedIdOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ClearRepOp` + if (value.getActualInstance() instanceof ClearRepOp) { + JsonElement element = adapterClearRepOp.toJsonTree((ClearRepOp)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp"); + } + + @Override + public SceneOperationOperationsInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize ChangeVisibilityOp + try { + // validate the JSON object to see if any exception is thrown + ChangeVisibilityOp.validateJsonElement(jsonElement); + actualAdapter = adapterChangeVisibilityOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ChangeVisibilityOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ChangeVisibilityOp'", e); + } + // deserialize ChangeMaterialOp + try { + // validate the JSON object to see if any exception is thrown + ChangeMaterialOp.validateJsonElement(jsonElement); + actualAdapter = adapterChangeMaterialOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ChangeMaterialOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ChangeMaterialOp'", e); + } + // deserialize ClearMaterialOp + try { + // validate the JSON object to see if any exception is thrown + ClearMaterialOp.validateJsonElement(jsonElement); + actualAdapter = adapterClearMaterialOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ClearMaterialOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ClearMaterialOp'", e); + } + // deserialize ChangeTransformOp + try { + // validate the JSON object to see if any exception is thrown + ChangeTransformOp.validateJsonElement(jsonElement); + actualAdapter = adapterChangeTransformOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ChangeTransformOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ChangeTransformOp'", e); + } + // deserialize ClearTransformOp + try { + // validate the JSON object to see if any exception is thrown + ClearTransformOp.validateJsonElement(jsonElement); + actualAdapter = adapterClearTransformOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ClearTransformOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ClearTransformOp'", e); + } + // deserialize SelectOp + try { + // validate the JSON object to see if any exception is thrown + SelectOp.validateJsonElement(jsonElement); + actualAdapter = adapterSelectOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SelectOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SelectOp'", e); + } + // deserialize DeselectOperation + try { + // validate the JSON object to see if any exception is thrown + DeselectOperation.validateJsonElement(jsonElement); + actualAdapter = adapterDeselectOperation; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for DeselectOperation failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'DeselectOperation'", e); + } + // deserialize ClearRenOp + try { + // validate the JSON object to see if any exception is thrown + ClearRenOp.validateJsonElement(jsonElement); + actualAdapter = adapterClearRenOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ClearRenOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ClearRenOp'", e); + } + // deserialize ViewDefaultRenOp + try { + // validate the JSON object to see if any exception is thrown + ViewDefaultRenOp.validateJsonElement(jsonElement); + actualAdapter = adapterViewDefaultRenOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ViewDefaultRenOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ViewDefaultRenOp'", e); + } + // deserialize ViewRenByIdOp + try { + // validate the JSON object to see if any exception is thrown + ViewRenByIdOp.validateJsonElement(jsonElement); + actualAdapter = adapterViewRenByIdOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ViewRenByIdOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ViewRenByIdOp'", e); + } + // deserialize ViewRenBySuppliedIdOp + try { + // validate the JSON object to see if any exception is thrown + ViewRenBySuppliedIdOp.validateJsonElement(jsonElement); + actualAdapter = adapterViewRenBySuppliedIdOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ViewRenBySuppliedIdOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ViewRenBySuppliedIdOp'", e); + } + // deserialize ViewRepByIdOp + try { + // validate the JSON object to see if any exception is thrown + ViewRepByIdOp.validateJsonElement(jsonElement); + actualAdapter = adapterViewRepByIdOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ViewRepByIdOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ViewRepByIdOp'", e); + } + // deserialize ViewRepByPredefinedIdOp + try { + // validate the JSON object to see if any exception is thrown + ViewRepByPredefinedIdOp.validateJsonElement(jsonElement); + actualAdapter = adapterViewRepByPredefinedIdOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ViewRepByPredefinedIdOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ViewRepByPredefinedIdOp'", e); + } + // deserialize ClearRepOp + try { + // validate the JSON object to see if any exception is thrown + ClearRepOp.validateJsonElement(jsonElement); + actualAdapter = adapterClearRepOp; + SceneOperationOperationsInner ret = new SceneOperationOperationsInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ClearRepOp failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ClearRepOp'", e); + } + + throw new IOException(String.format("Failed deserialization for SceneOperationOperationsInner: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public SceneOperationOperationsInner() { + super("anyOf", Boolean.FALSE); + } + + public SceneOperationOperationsInner(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ChangeVisibilityOp", ChangeVisibilityOp.class); + schemas.put("ChangeMaterialOp", ChangeMaterialOp.class); + schemas.put("ClearMaterialOp", ClearMaterialOp.class); + schemas.put("ChangeTransformOp", ChangeTransformOp.class); + schemas.put("ClearTransformOp", ClearTransformOp.class); + schemas.put("SelectOp", SelectOp.class); + schemas.put("DeselectOperation", DeselectOperation.class); + schemas.put("ClearRenOp", ClearRenOp.class); + schemas.put("ViewDefaultRenOp", ViewDefaultRenOp.class); + schemas.put("ViewRenByIdOp", ViewRenByIdOp.class); + schemas.put("ViewRenBySuppliedIdOp", ViewRenBySuppliedIdOp.class); + schemas.put("ViewRepByIdOp", ViewRepByIdOp.class); + schemas.put("ViewRepByPredefinedIdOp", ViewRepByPredefinedIdOp.class); + schemas.put("ClearRepOp", ClearRepOp.class); + } + + @Override + public Map> getSchemas() { + return SceneOperationOperationsInner.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof ChangeVisibilityOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ChangeMaterialOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ClearMaterialOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ChangeTransformOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ClearTransformOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SelectOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof DeselectOperation) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ClearRenOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ViewDefaultRenOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ViewRenByIdOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ViewRenBySuppliedIdOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ViewRepByIdOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ViewRepByPredefinedIdOp) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ClearRepOp) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp"); + } + + /** + * Get the actual instance, which can be the following: + * ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp + * + * @return The actual instance (ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ChangeVisibilityOp`. If the actual instance is not `ChangeVisibilityOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ChangeVisibilityOp` + * @throws ClassCastException if the instance is not `ChangeVisibilityOp` + */ + public ChangeVisibilityOp getChangeVisibilityOp() throws ClassCastException { + return (ChangeVisibilityOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ChangeMaterialOp`. If the actual instance is not `ChangeMaterialOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ChangeMaterialOp` + * @throws ClassCastException if the instance is not `ChangeMaterialOp` + */ + public ChangeMaterialOp getChangeMaterialOp() throws ClassCastException { + return (ChangeMaterialOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ClearMaterialOp`. If the actual instance is not `ClearMaterialOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ClearMaterialOp` + * @throws ClassCastException if the instance is not `ClearMaterialOp` + */ + public ClearMaterialOp getClearMaterialOp() throws ClassCastException { + return (ClearMaterialOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ChangeTransformOp`. If the actual instance is not `ChangeTransformOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ChangeTransformOp` + * @throws ClassCastException if the instance is not `ChangeTransformOp` + */ + public ChangeTransformOp getChangeTransformOp() throws ClassCastException { + return (ChangeTransformOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ClearTransformOp`. If the actual instance is not `ClearTransformOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ClearTransformOp` + * @throws ClassCastException if the instance is not `ClearTransformOp` + */ + public ClearTransformOp getClearTransformOp() throws ClassCastException { + return (ClearTransformOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `SelectOp`. If the actual instance is not `SelectOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SelectOp` + * @throws ClassCastException if the instance is not `SelectOp` + */ + public SelectOp getSelectOp() throws ClassCastException { + return (SelectOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `DeselectOperation`. If the actual instance is not `DeselectOperation`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DeselectOperation` + * @throws ClassCastException if the instance is not `DeselectOperation` + */ + public DeselectOperation getDeselectOperation() throws ClassCastException { + return (DeselectOperation)super.getActualInstance(); + } + + /** + * Get the actual instance of `ClearRenOp`. If the actual instance is not `ClearRenOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ClearRenOp` + * @throws ClassCastException if the instance is not `ClearRenOp` + */ + public ClearRenOp getClearRenOp() throws ClassCastException { + return (ClearRenOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ViewDefaultRenOp`. If the actual instance is not `ViewDefaultRenOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ViewDefaultRenOp` + * @throws ClassCastException if the instance is not `ViewDefaultRenOp` + */ + public ViewDefaultRenOp getViewDefaultRenOp() throws ClassCastException { + return (ViewDefaultRenOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ViewRenByIdOp`. If the actual instance is not `ViewRenByIdOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ViewRenByIdOp` + * @throws ClassCastException if the instance is not `ViewRenByIdOp` + */ + public ViewRenByIdOp getViewRenByIdOp() throws ClassCastException { + return (ViewRenByIdOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ViewRenBySuppliedIdOp`. If the actual instance is not `ViewRenBySuppliedIdOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ViewRenBySuppliedIdOp` + * @throws ClassCastException if the instance is not `ViewRenBySuppliedIdOp` + */ + public ViewRenBySuppliedIdOp getViewRenBySuppliedIdOp() throws ClassCastException { + return (ViewRenBySuppliedIdOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ViewRepByIdOp`. If the actual instance is not `ViewRepByIdOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ViewRepByIdOp` + * @throws ClassCastException if the instance is not `ViewRepByIdOp` + */ + public ViewRepByIdOp getViewRepByIdOp() throws ClassCastException { + return (ViewRepByIdOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ViewRepByPredefinedIdOp`. If the actual instance is not `ViewRepByPredefinedIdOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ViewRepByPredefinedIdOp` + * @throws ClassCastException if the instance is not `ViewRepByPredefinedIdOp` + */ + public ViewRepByPredefinedIdOp getViewRepByPredefinedIdOp() throws ClassCastException { + return (ViewRepByPredefinedIdOp)super.getActualInstance(); + } + + /** + * Get the actual instance of `ClearRepOp`. If the actual instance is not `ClearRepOp`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ClearRepOp` + * @throws ClassCastException if the instance is not `ClearRepOp` + */ + public ClearRepOp getClearRepOp() throws ClassCastException { + return (ClearRepOp)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneOperationOperationsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with ChangeVisibilityOp + try { + ChangeVisibilityOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ChangeVisibilityOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ChangeMaterialOp + try { + ChangeMaterialOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ChangeMaterialOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ClearMaterialOp + try { + ClearMaterialOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ClearMaterialOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ChangeTransformOp + try { + ChangeTransformOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ChangeTransformOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ClearTransformOp + try { + ClearTransformOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ClearTransformOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SelectOp + try { + SelectOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SelectOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with DeselectOperation + try { + DeselectOperation.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for DeselectOperation failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ClearRenOp + try { + ClearRenOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ClearRenOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ViewDefaultRenOp + try { + ViewDefaultRenOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ViewDefaultRenOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ViewRenByIdOp + try { + ViewRenByIdOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ViewRenByIdOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ViewRenBySuppliedIdOp + try { + ViewRenBySuppliedIdOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ViewRenBySuppliedIdOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ViewRepByIdOp + try { + ViewRepByIdOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ViewRepByIdOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ViewRepByPredefinedIdOp + try { + ViewRepByPredefinedIdOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ViewRepByPredefinedIdOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ClearRepOp + try { + ClearRepOp.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for ClearRepOp failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for SceneOperationOperationsInner with anyOf schemas: ChangeMaterialOp, ChangeTransformOp, ChangeVisibilityOp, ClearMaterialOp, ClearRenOp, ClearRepOp, ClearTransformOp, DeselectOperation, SelectOp, ViewDefaultRenOp, ViewRenByIdOp, ViewRenBySuppliedIdOp, ViewRepByIdOp, ViewRepByPredefinedIdOp. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of SceneOperationOperationsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneOperationOperationsInner + * @throws IOException if the JSON string is invalid with respect to SceneOperationOperationsInner + */ + public static SceneOperationOperationsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneOperationOperationsInner.class); + } + + /** + * Convert an instance of SceneOperationOperationsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneOperationQuery.java b/src/main/java/com/vertexvis/model/SceneOperationQuery.java new file mode 100644 index 0000000..d85f2b7 --- /dev/null +++ b/src/main/java/com/vertexvis/model/SceneOperationQuery.java @@ -0,0 +1,314 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.QueryAll; +import com.vertexvis.model.QueryByCollection; +import com.vertexvis.model.QueryByCollectionData; +import com.vertexvis.model.QueryById; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SceneOperationQuery extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SceneOperationQuery.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneOperationQuery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneOperationQuery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterQueryById = gson.getDelegateAdapter(this, TypeToken.get(QueryById.class)); + final TypeAdapter adapterQueryByCollection = gson.getDelegateAdapter(this, TypeToken.get(QueryByCollection.class)); + final TypeAdapter adapterQueryAll = gson.getDelegateAdapter(this, TypeToken.get(QueryAll.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneOperationQuery value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `QueryById` + if (value.getActualInstance() instanceof QueryById) { + JsonElement element = adapterQueryById.toJsonTree((QueryById)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `QueryByCollection` + if (value.getActualInstance() instanceof QueryByCollection) { + JsonElement element = adapterQueryByCollection.toJsonTree((QueryByCollection)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `QueryAll` + if (value.getActualInstance() instanceof QueryAll) { + JsonElement element = adapterQueryAll.toJsonTree((QueryAll)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: QueryAll, QueryByCollection, QueryById"); + } + + @Override + public SceneOperationQuery read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize QueryById + try { + // validate the JSON object to see if any exception is thrown + QueryById.validateJsonElement(jsonElement); + actualAdapter = adapterQueryById; + SceneOperationQuery ret = new SceneOperationQuery(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for QueryById failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'QueryById'", e); + } + // deserialize QueryByCollection + try { + // validate the JSON object to see if any exception is thrown + QueryByCollection.validateJsonElement(jsonElement); + actualAdapter = adapterQueryByCollection; + SceneOperationQuery ret = new SceneOperationQuery(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for QueryByCollection failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'QueryByCollection'", e); + } + // deserialize QueryAll + try { + // validate the JSON object to see if any exception is thrown + QueryAll.validateJsonElement(jsonElement); + actualAdapter = adapterQueryAll; + SceneOperationQuery ret = new SceneOperationQuery(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for QueryAll failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'QueryAll'", e); + } + + throw new IOException(String.format("Failed deserialization for SceneOperationQuery: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public SceneOperationQuery() { + super("anyOf", Boolean.FALSE); + } + + public SceneOperationQuery(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("QueryById", QueryById.class); + schemas.put("QueryByCollection", QueryByCollection.class); + schemas.put("QueryAll", QueryAll.class); + } + + @Override + public Map> getSchemas() { + return SceneOperationQuery.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * QueryAll, QueryByCollection, QueryById + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof QueryById) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof QueryByCollection) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof QueryAll) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be QueryAll, QueryByCollection, QueryById"); + } + + /** + * Get the actual instance, which can be the following: + * QueryAll, QueryByCollection, QueryById + * + * @return The actual instance (QueryAll, QueryByCollection, QueryById) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `QueryById`. If the actual instance is not `QueryById`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `QueryById` + * @throws ClassCastException if the instance is not `QueryById` + */ + public QueryById getQueryById() throws ClassCastException { + return (QueryById)super.getActualInstance(); + } + + /** + * Get the actual instance of `QueryByCollection`. If the actual instance is not `QueryByCollection`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `QueryByCollection` + * @throws ClassCastException if the instance is not `QueryByCollection` + */ + public QueryByCollection getQueryByCollection() throws ClassCastException { + return (QueryByCollection)super.getActualInstance(); + } + + /** + * Get the actual instance of `QueryAll`. If the actual instance is not `QueryAll`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `QueryAll` + * @throws ClassCastException if the instance is not `QueryAll` + */ + public QueryAll getQueryAll() throws ClassCastException { + return (QueryAll)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneOperationQuery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with QueryById + try { + QueryById.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for QueryById failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with QueryByCollection + try { + QueryByCollection.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for QueryByCollection failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with QueryAll + try { + QueryAll.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for QueryAll failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for SceneOperationQuery with anyOf schemas: QueryAll, QueryByCollection, QueryById. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of SceneOperationQuery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneOperationQuery + * @throws IOException if the JSON string is invalid with respect to SceneOperationQuery + */ + public static SceneOperationQuery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneOperationQuery.class); + } + + /** + * Convert an instance of SceneOperationQuery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/SceneRelationship.java b/src/main/java/com/vertexvis/model/SceneRelationship.java index 5f48109..215696f 100644 --- a/src/main/java/com/vertexvis/model/SceneRelationship.java +++ b/src/main/java/com/vertexvis/model/SceneRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `scene`. */ -@ApiModel(description = "Relationship to a `scene`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneRelationshipData data; - public SceneRelationship() { + public SceneRelationship() { } - public SceneRelationship data(SceneRelationshipData data) { - + public SceneRelationship data(@javax.annotation.Nonnull SceneRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneRelationshipData getData() { return data; } - - public void setData(SceneRelationshipData data) { + public void setData(@javax.annotation.Nonnull SceneRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneRelationship is not found in the empty JSON string", SceneRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneRelationship + * @throws IOException if the JSON string is invalid with respect to SceneRelationship + */ + public static SceneRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneRelationship.class); + } + + /** + * Convert an instance of SceneRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneRelationshipData.java b/src/main/java/com/vertexvis/model/SceneRelationshipData.java index 60620c6..59e1dc1 100644 --- a/src/main/java/com/vertexvis/model/SceneRelationshipData.java +++ b/src/main/java/com/vertexvis/model/SceneRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public SceneRelationshipData() { + public SceneRelationshipData() { } - public SceneRelationshipData type(TypeEnum type) { - + public SceneRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public SceneRelationshipData id(UUID id) { - + public SceneRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneRelationshipData is not found in the empty JSON string", SceneRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneRelationshipData + * @throws IOException if the JSON string is invalid with respect to SceneRelationshipData + */ + public static SceneRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneRelationshipData.class); + } + + /** + * Convert an instance of SceneRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSync.java b/src/main/java/com/vertexvis/model/SceneSync.java index ce40fde..8c7ad31 100644 --- a/src/main/java/com/vertexvis/model/SceneSync.java +++ b/src/main/java/com/vertexvis/model/SceneSync.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneSyncData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneSync */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSync { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneSyncData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneSync() { + public SceneSync() { } - public SceneSync data(SceneSyncData data) { - + public SceneSync data(@javax.annotation.Nonnull SceneSyncData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneSyncData getData() { return data; } - - public void setData(SceneSyncData data) { + public void setData(@javax.annotation.Nonnull SceneSyncData data) { this.data = data; } - public SceneSync links(Map links) { - + public SceneSync links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneSync putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSync + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSync.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSync is not found in the empty JSON string", SceneSync.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSync.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSync` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSync.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneSyncData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSync.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSync' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSync.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSync value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSync read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSync given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSync + * @throws IOException if the JSON string is invalid with respect to SceneSync + */ + public static SceneSync fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSync.class); + } + + /** + * Convert an instance of SceneSync to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncData.java b/src/main/java/com/vertexvis/model/SceneSyncData.java index 6dd545e..ee502d2 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncData.java +++ b/src/main/java/com/vertexvis/model/SceneSyncData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneSyncDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneSyncData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneSyncDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneSyncData() { + public SceneSyncData() { } - public SceneSyncData type(String type) { - + public SceneSyncData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneSyncData id(UUID id) { - + public SceneSyncData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneSyncData attributes(SceneSyncDataAttributes attributes) { - + public SceneSyncData attributes(@javax.annotation.Nonnull SceneSyncDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneSyncDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneSyncDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneSyncDataAttributes attributes) { this.attributes = attributes; } - public SceneSyncData links(Map links) { - + public SceneSyncData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public SceneSyncData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncData is not found in the empty JSON string", SceneSyncData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneSyncDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncData + * @throws IOException if the JSON string is invalid with respect to SceneSyncData + */ + public static SceneSyncData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncData.class); + } + + /** + * Convert an instance of SceneSyncData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncDataAttributes.java b/src/main/java/com/vertexvis/model/SceneSyncDataAttributes.java index e383e63..5de618a 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneSyncDataAttributes.java @@ -14,106 +14,119 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneSyncDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_COMPLETED_AT = "completedAt"; @SerializedName(SERIALIZED_NAME_COMPLETED_AT) + @javax.annotation.Nonnull private OffsetDateTime completedAt; public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; - public SceneSyncDataAttributes() { + public SceneSyncDataAttributes() { } - public SceneSyncDataAttributes created(OffsetDateTime created) { - + public SceneSyncDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public SceneSyncDataAttributes completedAt(OffsetDateTime completedAt) { - + public SceneSyncDataAttributes completedAt(@javax.annotation.Nonnull OffsetDateTime completedAt) { this.completedAt = completedAt; return this; } - /** + /** * Get completedAt * @return completedAt - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCompletedAt() { return completedAt; } - - public void setCompletedAt(OffsetDateTime completedAt) { + public void setCompletedAt(@javax.annotation.Nonnull OffsetDateTime completedAt) { this.completedAt = completedAt; } - public SceneSyncDataAttributes status(String status) { - + public SceneSyncDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "completed", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } + @Override public boolean equals(Object o) { if (this == o) { @@ -155,5 +168,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("completedAt"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("completedAt"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncDataAttributes is not found in the empty JSON string", SceneSyncDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneSyncDataAttributes + */ + public static SceneSyncDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncDataAttributes.class); + } + + /** + * Convert an instance of SceneSyncDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncItemResultData.java b/src/main/java/com/vertexvis/model/SceneSyncItemResultData.java index dda0261..d30c4d3 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncItemResultData.java +++ b/src/main/java/com/vertexvis/model/SceneSyncItemResultData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,113 +22,126 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneSyncItemResultDataAttributes; import com.vertexvis.model.SceneSyncItemResultDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneSyncItemResultData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncItemResultData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneSyncItemResultDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneSyncItemResultDataRelationships relationships; - public SceneSyncItemResultData() { + public SceneSyncItemResultData() { } - public SceneSyncItemResultData type(String type) { - + public SceneSyncItemResultData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-sync-item-result", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneSyncItemResultData id(UUID id) { - + public SceneSyncItemResultData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneSyncItemResultData attributes(SceneSyncItemResultDataAttributes attributes) { - + public SceneSyncItemResultData attributes(@javax.annotation.Nonnull SceneSyncItemResultDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneSyncItemResultDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneSyncItemResultDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneSyncItemResultDataAttributes attributes) { this.attributes = attributes; } - public SceneSyncItemResultData links(Map links) { - + public SceneSyncItemResultData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -142,46 +154,40 @@ public SceneSyncItemResultData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } - public SceneSyncItemResultData relationships(SceneSyncItemResultDataRelationships relationships) { - + public SceneSyncItemResultData relationships(@javax.annotation.Nonnull SceneSyncItemResultDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneSyncItemResultDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneSyncItemResultDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneSyncItemResultDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncItemResultData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncItemResultData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncItemResultData is not found in the empty JSON string", SceneSyncItemResultData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncItemResultData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncItemResultData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncItemResultData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneSyncItemResultDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneSyncItemResultDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncItemResultData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncItemResultData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncItemResultData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncItemResultData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncItemResultData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncItemResultData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncItemResultData + * @throws IOException if the JSON string is invalid with respect to SceneSyncItemResultData + */ + public static SceneSyncItemResultData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncItemResultData.class); + } + + /** + * Convert an instance of SceneSyncItemResultData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncItemResultDataAttributes.java b/src/main/java/com/vertexvis/model/SceneSyncItemResultDataAttributes.java index 28082b0..c98b145 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncItemResultDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneSyncItemResultDataAttributes.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ApiError; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneSyncItemResultDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncItemResultDataAttributes { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; public static final String SERIALIZED_NAME_ERROR = "error"; @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable private ApiError error; - public SceneSyncItemResultDataAttributes() { + public SceneSyncItemResultDataAttributes() { } - public SceneSyncItemResultDataAttributes status(String status) { - + public SceneSyncItemResultDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "running", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } - public SceneSyncItemResultDataAttributes error(ApiError error) { - + public SceneSyncItemResultDataAttributes error(@javax.annotation.Nullable ApiError error) { this.error = error; return this; } - /** + /** * Get error * @return error - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ApiError getError() { return error; } - - public void setError(ApiError error) { + public void setError(@javax.annotation.Nullable ApiError error) { this.error = error; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("error"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncItemResultDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncItemResultDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncItemResultDataAttributes is not found in the empty JSON string", SceneSyncItemResultDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncItemResultDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncItemResultDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncItemResultDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `error` + if (jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) { + ApiError.validateJsonElement(jsonObj.get("error")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncItemResultDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncItemResultDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncItemResultDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncItemResultDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncItemResultDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncItemResultDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncItemResultDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneSyncItemResultDataAttributes + */ + public static SceneSyncItemResultDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncItemResultDataAttributes.class); + } + + /** + * Convert an instance of SceneSyncItemResultDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncItemResultDataRelationships.java b/src/main/java/com/vertexvis/model/SceneSyncItemResultDataRelationships.java index c8ae8ec..36ed49e 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncItemResultDataRelationships.java +++ b/src/main/java/com/vertexvis/model/SceneSyncItemResultDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneItemRelationship; import com.vertexvis.model.SceneRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneSyncItemResultDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncItemResultDataRelationships { public static final String SERIALIZED_NAME_SCENE = "scene"; @SerializedName(SERIALIZED_NAME_SCENE) + @javax.annotation.Nonnull private SceneRelationship scene; public static final String SERIALIZED_NAME_SCENE_ITEM = "sceneItem"; @SerializedName(SERIALIZED_NAME_SCENE_ITEM) + @javax.annotation.Nonnull private SceneItemRelationship sceneItem; - public SceneSyncItemResultDataRelationships() { + public SceneSyncItemResultDataRelationships() { } - public SceneSyncItemResultDataRelationships scene(SceneRelationship scene) { - + public SceneSyncItemResultDataRelationships scene(@javax.annotation.Nonnull SceneRelationship scene) { this.scene = scene; return this; } - /** + /** * Get scene * @return scene - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneRelationship getScene() { return scene; } - - public void setScene(SceneRelationship scene) { + public void setScene(@javax.annotation.Nonnull SceneRelationship scene) { this.scene = scene; } - public SceneSyncItemResultDataRelationships sceneItem(SceneItemRelationship sceneItem) { - + public SceneSyncItemResultDataRelationships sceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; return this; } - /** + /** * Get sceneItem * @return sceneItem - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemRelationship getSceneItem() { return sceneItem; } - - public void setSceneItem(SceneItemRelationship sceneItem) { + public void setSceneItem(@javax.annotation.Nonnull SceneItemRelationship sceneItem) { this.sceneItem = sceneItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scene"); + openapiFields.add("sceneItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scene"); + openapiRequiredFields.add("sceneItem"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncItemResultDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncItemResultDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncItemResultDataRelationships is not found in the empty JSON string", SceneSyncItemResultDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncItemResultDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncItemResultDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncItemResultDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `scene` + SceneRelationship.validateJsonElement(jsonObj.get("scene")); + // validate the required field `sceneItem` + SceneItemRelationship.validateJsonElement(jsonObj.get("sceneItem")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncItemResultDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncItemResultDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncItemResultDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncItemResultDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncItemResultDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncItemResultDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncItemResultDataRelationships + * @throws IOException if the JSON string is invalid with respect to SceneSyncItemResultDataRelationships + */ + public static SceneSyncItemResultDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncItemResultDataRelationships.class); + } + + /** + * Convert an instance of SceneSyncItemResultDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneSyncItemResultsList.java b/src/main/java/com/vertexvis/model/SceneSyncItemResultsList.java index 95160d6..3f3981f 100644 --- a/src/main/java/com/vertexvis/model/SceneSyncItemResultsList.java +++ b/src/main/java/com/vertexvis/model/SceneSyncItemResultsList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,118 +22,141 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemData; import com.vertexvis.model.SceneSyncItemResultData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneSyncItemResultsList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneSyncItemResultsList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) + @javax.annotation.Nonnull private List included = new ArrayList<>(); - public SceneSyncItemResultsList() { + public SceneSyncItemResultsList() { } - public SceneSyncItemResultsList data(List data) { - + public SceneSyncItemResultsList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneSyncItemResultsList addDataItem(SceneSyncItemResultData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneSyncItemResultsList links(Map links) { - + public SceneSyncItemResultsList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneSyncItemResultsList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } - public SceneSyncItemResultsList included(List included) { - + public SceneSyncItemResultsList included(@javax.annotation.Nonnull List included) { this.included = included; return this; } public SceneSyncItemResultsList addIncludedItem(SceneItemData includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } this.included.add(includedItem); return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nonnull List included) { this.included = included; } + @Override public boolean equals(Object o) { if (this == o) { @@ -176,5 +198,121 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + openapiRequiredFields.add("included"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneSyncItemResultsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneSyncItemResultsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneSyncItemResultsList is not found in the empty JSON string", SceneSyncItemResultsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneSyncItemResultsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneSyncItemResultsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneSyncItemResultsList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneSyncItemResultData.validateJsonElement(jsonArraydata.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + // validate the required field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + SceneItemData.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneSyncItemResultsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneSyncItemResultsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneSyncItemResultsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneSyncItemResultsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneSyncItemResultsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneSyncItemResultsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneSyncItemResultsList + * @throws IOException if the JSON string is invalid with respect to SceneSyncItemResultsList + */ + public static SceneSyncItemResultsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneSyncItemResultsList.class); + } + + /** + * Convert an instance of SceneSyncItemResultsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneView.java b/src/main/java/com/vertexvis/model/SceneView.java index 0467f3f..eddddc3 100644 --- a/src/main/java/com/vertexvis/model/SceneView.java +++ b/src/main/java/com/vertexvis/model/SceneView.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneView */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneView { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneViewData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneView() { + public SceneView() { } - public SceneView data(SceneViewData data) { - + public SceneView data(@javax.annotation.Nonnull SceneViewData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewData getData() { return data; } - - public void setData(SceneViewData data) { + public void setData(@javax.annotation.Nonnull SceneViewData data) { this.data = data; } - public SceneView links(Map links) { - + public SceneView links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneView putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneView + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneView.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneView is not found in the empty JSON string", SceneView.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneView.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneView` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneView.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneViewData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneView.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneView' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneView.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneView value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneView read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneView given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneView + * @throws IOException if the JSON string is invalid with respect to SceneView + */ + public static SceneView fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneView.class); + } + + /** + * Convert an instance of SceneView to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewData.java b/src/main/java/com/vertexvis/model/SceneViewData.java index 310d412..0e4ce3c 100644 --- a/src/main/java/com/vertexvis/model/SceneViewData.java +++ b/src/main/java/com/vertexvis/model/SceneViewData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,127 +21,138 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneViewDataAttributes; import com.vertexvis.model.SceneViewDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneViewDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneViewDataRelationships relationships; - public SceneViewData() { + public SceneViewData() { } - public SceneViewData type(String type) { - + public SceneViewData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneViewData id(UUID id) { - + public SceneViewData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneViewData attributes(SceneViewDataAttributes attributes) { - + public SceneViewData attributes(@javax.annotation.Nonnull SceneViewDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneViewDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneViewDataAttributes attributes) { this.attributes = attributes; } - public SceneViewData relationships(SceneViewDataRelationships relationships) { - + public SceneViewData relationships(@javax.annotation.Nonnull SceneViewDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneViewDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneViewDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -186,5 +196,113 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewData is not found in the empty JSON string", SceneViewData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneViewDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneViewDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewData + * @throws IOException if the JSON string is invalid with respect to SceneViewData + */ + public static SceneViewData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewData.class); + } + + /** + * Convert an instance of SceneViewData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewDataAttributes.java b/src/main/java/com/vertexvis/model/SceneViewDataAttributes.java index 0d7705e..f372cfc 100644 --- a/src/main/java/com/vertexvis/model/SceneViewDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneViewDataAttributes.java @@ -14,165 +14,171 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera; import com.vertexvis.model.CrossSectioning; import com.vertexvis.model.Orientation; -import com.vertexvis.model.OrthographicCamera; -import com.vertexvis.model.PerspectiveCamera; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; import org.openapitools.jackson.nullable.JsonNullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private OneOfPerspectiveCameraOrthographicCamera camera; + @javax.annotation.Nonnull + private CreateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_CROSS_SECTIONING = "crossSectioning"; @SerializedName(SERIALIZED_NAME_CROSS_SECTIONING) + @javax.annotation.Nullable private CrossSectioning crossSectioning; public static final String SERIALIZED_NAME_WORLD_ORIENTATION = "worldOrientation"; @SerializedName(SERIALIZED_NAME_WORLD_ORIENTATION) + @javax.annotation.Nullable private Orientation worldOrientation; public static final String SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS = "excludePrunedItems"; @SerializedName(SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS) + @javax.annotation.Nullable private Boolean excludePrunedItems; - public SceneViewDataAttributes() { + public SceneViewDataAttributes() { } - public SceneViewDataAttributes camera(OneOfPerspectiveCameraOrthographicCamera camera) { - + public SceneViewDataAttributes camera(@javax.annotation.Nonnull CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "") - - public OneOfPerspectiveCameraOrthographicCamera getCamera() { + */ + @javax.annotation.Nonnull + public CreateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(OneOfPerspectiveCameraOrthographicCamera camera) { + public void setCamera(@javax.annotation.Nonnull CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public SceneViewDataAttributes created(OffsetDateTime created) { - + public SceneViewDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public SceneViewDataAttributes crossSectioning(CrossSectioning crossSectioning) { - + public SceneViewDataAttributes crossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; return this; } - /** + /** * Get crossSectioning * @return crossSectioning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CrossSectioning getCrossSectioning() { return crossSectioning; } - - public void setCrossSectioning(CrossSectioning crossSectioning) { + public void setCrossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; } - public SceneViewDataAttributes worldOrientation(Orientation worldOrientation) { - + public SceneViewDataAttributes worldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; return this; } - /** + /** * Get worldOrientation * @return worldOrientation - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Orientation getWorldOrientation() { return worldOrientation; } - - public void setWorldOrientation(Orientation worldOrientation) { + public void setWorldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; } - public SceneViewDataAttributes excludePrunedItems(Boolean excludePrunedItems) { - + public SceneViewDataAttributes excludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; return this; } - /** + /** * Whether to exclude non-visible items in the view * @return excludePrunedItems - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Whether to exclude non-visible items in the view") - public Boolean getExcludePrunedItems() { return excludePrunedItems; } - - public void setExcludePrunedItems(Boolean excludePrunedItems) { + public void setExcludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; } + @Override public boolean equals(Object o) { if (this == o) { @@ -229,5 +235,112 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("created"); + openapiFields.add("crossSectioning"); + openapiFields.add("worldOrientation"); + openapiFields.add("excludePrunedItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("camera"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewDataAttributes is not found in the empty JSON string", SceneViewDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `camera` + CreateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + // validate the optional field `crossSectioning` + if (jsonObj.get("crossSectioning") != null && !jsonObj.get("crossSectioning").isJsonNull()) { + CrossSectioning.validateJsonElement(jsonObj.get("crossSectioning")); + } + // validate the optional field `worldOrientation` + if (jsonObj.get("worldOrientation") != null && !jsonObj.get("worldOrientation").isJsonNull()) { + Orientation.validateJsonElement(jsonObj.get("worldOrientation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneViewDataAttributes + */ + public static SceneViewDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewDataAttributes.class); + } + + /** + * Convert an instance of SceneViewDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewDataRelationships.java b/src/main/java/com/vertexvis/model/SceneViewDataRelationships.java index fea2450..9a41c55 100644 --- a/src/main/java/com/vertexvis/model/SceneViewDataRelationships.java +++ b/src/main/java/com/vertexvis/model/SceneViewDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneRelationship; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneViewDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewDataRelationships { public static final String SERIALIZED_NAME_SCENE = "scene"; @SerializedName(SERIALIZED_NAME_SCENE) + @javax.annotation.Nonnull private SceneRelationship scene; - public SceneViewDataRelationships() { + public SceneViewDataRelationships() { } - public SceneViewDataRelationships scene(SceneRelationship scene) { - + public SceneViewDataRelationships scene(@javax.annotation.Nonnull SceneRelationship scene) { this.scene = scene; return this; } - /** + /** * Get scene * @return scene - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneRelationship getScene() { return scene; } - - public void setScene(SceneRelationship scene) { + public void setScene(@javax.annotation.Nonnull SceneRelationship scene) { this.scene = scene; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scene"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scene"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewDataRelationships is not found in the empty JSON string", SceneViewDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `scene` + SceneRelationship.validateJsonElement(jsonObj.get("scene")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewDataRelationships + * @throws IOException if the JSON string is invalid with respect to SceneViewDataRelationships + */ + public static SceneViewDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewDataRelationships.class); + } + + /** + * Convert an instance of SceneViewDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewItem.java b/src/main/java/com/vertexvis/model/SceneViewItem.java index 31e20f1..9c894fe 100644 --- a/src/main/java/com/vertexvis/model/SceneViewItem.java +++ b/src/main/java/com/vertexvis/model/SceneViewItem.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,59 +22,79 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneItemData; import com.vertexvis.model.SceneItemOverrideData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneViewItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewItem { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneItemData data; public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) - private List included = null; + @javax.annotation.Nullable + private List included = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneViewItem() { + public SceneViewItem() { } - public SceneViewItem data(SceneItemData data) { - + public SceneViewItem data(@javax.annotation.Nonnull SceneItemData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneItemData getData() { return data; } - - public void setData(SceneItemData data) { + public void setData(@javax.annotation.Nonnull SceneItemData data) { this.data = data; } - public SceneViewItem included(List included) { - + public SceneViewItem included(@javax.annotation.Nullable List included) { this.included = included; return this; } @@ -88,25 +107,21 @@ public SceneViewItem addIncludedItem(SceneItemOverrideData includedItem) { return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nullable List included) { this.included = included; } - public SceneViewItem links(Map links) { - + public SceneViewItem links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -119,23 +134,21 @@ public SceneViewItem putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -177,5 +190,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewItem is not found in the empty JSON string", SceneViewItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneItemData.validateJsonElement(jsonObj.get("data")); + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + SceneItemOverrideData.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewItem + * @throws IOException if the JSON string is invalid with respect to SceneViewItem + */ + public static SceneViewItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewItem.class); + } + + /** + * Convert an instance of SceneViewItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewList.java b/src/main/java/com/vertexvis/model/SceneViewList.java index 545882b..15a7d0c 100644 --- a/src/main/java/com/vertexvis/model/SceneViewList.java +++ b/src/main/java/com/vertexvis/model/SceneViewList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneViewList() { + public SceneViewList() { } - public SceneViewList data(List data) { - + public SceneViewList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneViewList addDataItem(SceneViewData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneViewList links(Map links) { - + public SceneViewList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneViewList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewList is not found in the empty JSON string", SceneViewList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneViewData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewList + * @throws IOException if the JSON string is invalid with respect to SceneViewList + */ + public static SceneViewList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewList.class); + } + + /** + * Convert an instance of SceneViewList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewRelationship.java b/src/main/java/com/vertexvis/model/SceneViewRelationship.java index e7110e5..8cb688f 100644 --- a/src/main/java/com/vertexvis/model/SceneViewRelationship.java +++ b/src/main/java/com/vertexvis/model/SceneViewRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneViewRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `scene-view`. */ -@ApiModel(description = "Relationship to a `scene-view`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneViewRelationshipData data; - public SceneViewRelationship() { + public SceneViewRelationship() { } - public SceneViewRelationship data(SceneViewRelationshipData data) { - + public SceneViewRelationship data(@javax.annotation.Nonnull SceneViewRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewRelationshipData getData() { return data; } - - public void setData(SceneViewRelationshipData data) { + public void setData(@javax.annotation.Nonnull SceneViewRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewRelationship is not found in the empty JSON string", SceneViewRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneViewRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewRelationship + * @throws IOException if the JSON string is invalid with respect to SceneViewRelationship + */ + public static SceneViewRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewRelationship.class); + } + + /** + * Convert an instance of SceneViewRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewRelationshipData.java b/src/main/java/com/vertexvis/model/SceneViewRelationshipData.java index fc1b002..c23d635 100644 --- a/src/main/java/com/vertexvis/model/SceneViewRelationshipData.java +++ b/src/main/java/com/vertexvis/model/SceneViewRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public SceneViewRelationshipData() { + public SceneViewRelationshipData() { } - public SceneViewRelationshipData type(TypeEnum type) { - + public SceneViewRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public SceneViewRelationshipData id(UUID id) { - + public SceneViewRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewRelationshipData is not found in the empty JSON string", SceneViewRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewRelationshipData + * @throws IOException if the JSON string is invalid with respect to SceneViewRelationshipData + */ + public static SceneViewRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewRelationshipData.class); + } + + /** + * Convert an instance of SceneViewRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewState.java b/src/main/java/com/vertexvis/model/SceneViewState.java index c124172..374d5e6 100644 --- a/src/main/java/com/vertexvis/model/SceneViewState.java +++ b/src/main/java/com/vertexvis/model/SceneViewState.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewStateData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneViewState */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewState { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneViewStateData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneViewState() { + public SceneViewState() { } - public SceneViewState data(SceneViewStateData data) { - + public SceneViewState data(@javax.annotation.Nonnull SceneViewStateData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewStateData getData() { return data; } - - public void setData(SceneViewStateData data) { + public void setData(@javax.annotation.Nonnull SceneViewStateData data) { this.data = data; } - public SceneViewState links(Map links) { - + public SceneViewState links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public SceneViewState putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewState + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewState.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewState is not found in the empty JSON string", SceneViewState.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewState.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewState` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewState.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneViewStateData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewState.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewState' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewState.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewState value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewState read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewState given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewState + * @throws IOException if the JSON string is invalid with respect to SceneViewState + */ + public static SceneViewState fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewState.class); + } + + /** + * Convert an instance of SceneViewState to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewStateData.java b/src/main/java/com/vertexvis/model/SceneViewStateData.java index 88637e6..d38ae8e 100644 --- a/src/main/java/com/vertexvis/model/SceneViewStateData.java +++ b/src/main/java/com/vertexvis/model/SceneViewStateData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewStateDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewStateData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewStateData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private SceneViewStateDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public SceneViewStateData() { + public SceneViewStateData() { } - public SceneViewStateData type(String type) { - + public SceneViewStateData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view-state", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public SceneViewStateData id(UUID id) { - + public SceneViewStateData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public SceneViewStateData attributes(SceneViewStateDataAttributes attributes) { - + public SceneViewStateData attributes(@javax.annotation.Nonnull SceneViewStateDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewStateDataAttributes getAttributes() { return attributes; } - - public void setAttributes(SceneViewStateDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull SceneViewStateDataAttributes attributes) { this.attributes = attributes; } - public SceneViewStateData links(Map links) { - + public SceneViewStateData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public SceneViewStateData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewStateData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewStateData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewStateData is not found in the empty JSON string", SceneViewStateData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewStateData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewStateData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewStateData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + SceneViewStateDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewStateData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewStateData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewStateData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewStateData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewStateData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewStateData + * @throws IOException if the JSON string is invalid with respect to SceneViewStateData + */ + public static SceneViewStateData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewStateData.class); + } + + /** + * Convert an instance of SceneViewStateData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewStateDataAttributes.java b/src/main/java/com/vertexvis/model/SceneViewStateDataAttributes.java index ba790ae..97be182 100644 --- a/src/main/java/com/vertexvis/model/SceneViewStateDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneViewStateDataAttributes.java @@ -14,131 +14,144 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneViewRequestDataAttributesCamera; import com.vertexvis.model.FeatureLines; -import com.vertexvis.model.OrthographicCamera; -import com.vertexvis.model.PerspectiveCamera; import com.vertexvis.model.ThumbnailData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SceneViewStateDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewStateDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private OneOfPerspectiveCameraOrthographicCamera camera; + @javax.annotation.Nullable + private CreateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_THUMBNAILS = "thumbnails"; @SerializedName(SERIALIZED_NAME_THUMBNAILS) - private List thumbnails = null; + @javax.annotation.Nullable + private List thumbnails = new ArrayList<>(); public static final String SERIALIZED_NAME_FEATURE_LINES = "featureLines"; @SerializedName(SERIALIZED_NAME_FEATURE_LINES) + @javax.annotation.Nullable private FeatureLines featureLines; public static final String SERIALIZED_NAME_NO_DEFAULT_LIGHTS = "noDefaultLights"; @SerializedName(SERIALIZED_NAME_NO_DEFAULT_LIGHTS) + @javax.annotation.Nullable private Boolean noDefaultLights; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; - public SceneViewStateDataAttributes() { + public SceneViewStateDataAttributes() { } - public SceneViewStateDataAttributes camera(OneOfPerspectiveCameraOrthographicCamera camera) { - + public SceneViewStateDataAttributes camera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public OneOfPerspectiveCameraOrthographicCamera getCamera() { + public CreateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(OneOfPerspectiveCameraOrthographicCamera camera) { + public void setCamera(@javax.annotation.Nullable CreateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public SceneViewStateDataAttributes created(OffsetDateTime created) { - + public SceneViewStateDataAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public SceneViewStateDataAttributes name(String name) { - + public SceneViewStateDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public SceneViewStateDataAttributes thumbnails(List thumbnails) { - + public SceneViewStateDataAttributes thumbnails(@javax.annotation.Nullable List thumbnails) { this.thumbnails = thumbnails; return this; } @@ -151,92 +164,78 @@ public SceneViewStateDataAttributes addThumbnailsItem(ThumbnailData thumbnailsIt return this; } - /** + /** * Get thumbnails * @return thumbnails - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getThumbnails() { return thumbnails; } - - public void setThumbnails(List thumbnails) { + public void setThumbnails(@javax.annotation.Nullable List thumbnails) { this.thumbnails = thumbnails; } - public SceneViewStateDataAttributes featureLines(FeatureLines featureLines) { - + public SceneViewStateDataAttributes featureLines(@javax.annotation.Nullable FeatureLines featureLines) { this.featureLines = featureLines; return this; } - /** + /** * Get featureLines * @return featureLines - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public FeatureLines getFeatureLines() { return featureLines; } - - public void setFeatureLines(FeatureLines featureLines) { + public void setFeatureLines(@javax.annotation.Nullable FeatureLines featureLines) { this.featureLines = featureLines; } - public SceneViewStateDataAttributes noDefaultLights(Boolean noDefaultLights) { - + public SceneViewStateDataAttributes noDefaultLights(@javax.annotation.Nullable Boolean noDefaultLights) { this.noDefaultLights = noDefaultLights; return this; } - /** + /** * Get noDefaultLights * @return noDefaultLights - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getNoDefaultLights() { return noDefaultLights; } - - public void setNoDefaultLights(Boolean noDefaultLights) { + public void setNoDefaultLights(@javax.annotation.Nullable Boolean noDefaultLights) { this.noDefaultLights = noDefaultLights; } - public SceneViewStateDataAttributes suppliedId(String suppliedId) { - + public SceneViewStateDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } + @Override public boolean equals(Object o) { if (this == o) { @@ -255,22 +254,11 @@ public boolean equals(Object o) { Objects.equals(this.suppliedId, sceneViewStateDataAttributes.suppliedId); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(camera, created, name, thumbnails, featureLines, noDefaultLights, suppliedId); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -297,5 +285,123 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("created"); + openapiFields.add("name"); + openapiFields.add("thumbnails"); + openapiFields.add("featureLines"); + openapiFields.add("noDefaultLights"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewStateDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewStateDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewStateDataAttributes is not found in the empty JSON string", SceneViewStateDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewStateDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewStateDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + CreateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("thumbnails") != null && !jsonObj.get("thumbnails").isJsonNull()) { + JsonArray jsonArraythumbnails = jsonObj.getAsJsonArray("thumbnails"); + if (jsonArraythumbnails != null) { + // ensure the json data is an array + if (!jsonObj.get("thumbnails").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `thumbnails` to be an array in the JSON string but got `%s`", jsonObj.get("thumbnails").toString())); + } + + // validate the optional field `thumbnails` (array) + for (int i = 0; i < jsonArraythumbnails.size(); i++) { + ThumbnailData.validateJsonElement(jsonArraythumbnails.get(i)); + }; + } + } + // validate the optional field `featureLines` + if (jsonObj.get("featureLines") != null && !jsonObj.get("featureLines").isJsonNull()) { + FeatureLines.validateJsonElement(jsonObj.get("featureLines")); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewStateDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewStateDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewStateDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewStateDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewStateDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewStateDataAttributes + * @throws IOException if the JSON string is invalid with respect to SceneViewStateDataAttributes + */ + public static SceneViewStateDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewStateDataAttributes.class); + } + + /** + * Convert an instance of SceneViewStateDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewStateList.java b/src/main/java/com/vertexvis/model/SceneViewStateList.java index 8bca325..0c55626 100644 --- a/src/main/java/com/vertexvis/model/SceneViewStateList.java +++ b/src/main/java/com/vertexvis/model/SceneViewStateList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewStateData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewStateList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewStateList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public SceneViewStateList() { + public SceneViewStateList() { } - public SceneViewStateList data(List data) { - + public SceneViewStateList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public SceneViewStateList addDataItem(SceneViewStateData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public SceneViewStateList links(Map links) { - + public SceneViewStateList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public SceneViewStateList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewStateList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewStateList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewStateList is not found in the empty JSON string", SceneViewStateList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewStateList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewStateList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewStateList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + SceneViewStateData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewStateList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewStateList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewStateList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewStateList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewStateList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewStateList + * @throws IOException if the JSON string is invalid with respect to SceneViewStateList + */ + public static SceneViewStateList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewStateList.class); + } + + /** + * Convert an instance of SceneViewStateList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewStateRelationship.java b/src/main/java/com/vertexvis/model/SceneViewStateRelationship.java index 6b18707..86cf713 100644 --- a/src/main/java/com/vertexvis/model/SceneViewStateRelationship.java +++ b/src/main/java/com/vertexvis/model/SceneViewStateRelationship.java @@ -14,53 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.SceneViewStateRelationshipData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `scene-view-state`. */ -@ApiModel(description = "Relationship to a `scene-view-state`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewStateRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private SceneViewStateRelationshipData data; - public SceneViewStateRelationship() { + public SceneViewStateRelationship() { } - public SceneViewStateRelationship data(SceneViewStateRelationshipData data) { - + public SceneViewStateRelationship data(@javax.annotation.Nonnull SceneViewStateRelationshipData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewStateRelationshipData getData() { return data; } - - public void setData(SceneViewStateRelationshipData data) { + public void setData(@javax.annotation.Nonnull SceneViewStateRelationshipData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -98,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewStateRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewStateRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewStateRelationship is not found in the empty JSON string", SceneViewStateRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewStateRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewStateRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewStateRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + SceneViewStateRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewStateRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewStateRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewStateRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewStateRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewStateRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewStateRelationship + * @throws IOException if the JSON string is invalid with respect to SceneViewStateRelationship + */ + public static SceneViewStateRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewStateRelationship.class); + } + + /** + * Convert an instance of SceneViewStateRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SceneViewStateRelationshipData.java b/src/main/java/com/vertexvis/model/SceneViewStateRelationshipData.java index 790a2c8..3b6cfde 100644 --- a/src/main/java/com/vertexvis/model/SceneViewStateRelationshipData.java +++ b/src/main/java/com/vertexvis/model/SceneViewStateRelationshipData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SceneViewStateRelationshipData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SceneViewStateRelationshipData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public SceneViewStateRelationshipData() { + public SceneViewStateRelationshipData() { } - public SceneViewStateRelationshipData type(TypeEnum type) { - + public SceneViewStateRelationshipData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view-state", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public SceneViewStateRelationshipData id(UUID id) { - + public SceneViewStateRelationshipData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SceneViewStateRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SceneViewStateRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SceneViewStateRelationshipData is not found in the empty JSON string", SceneViewStateRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SceneViewStateRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SceneViewStateRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SceneViewStateRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SceneViewStateRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SceneViewStateRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SceneViewStateRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SceneViewStateRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SceneViewStateRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SceneViewStateRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of SceneViewStateRelationshipData + * @throws IOException if the JSON string is invalid with respect to SceneViewStateRelationshipData + */ + public static SceneViewStateRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SceneViewStateRelationshipData.class); + } + + /** + * Convert an instance of SceneViewStateRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SectionPlane.java b/src/main/java/com/vertexvis/model/SectionPlane.java index 9b15b5a..fc6bba4 100644 --- a/src/main/java/com/vertexvis/model/SectionPlane.java +++ b/src/main/java/com/vertexvis/model/SectionPlane.java @@ -14,80 +14,96 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Vector3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * SectionPlane */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SectionPlane { public static final String SERIALIZED_NAME_NORMAL = "normal"; @SerializedName(SERIALIZED_NAME_NORMAL) + @javax.annotation.Nonnull private Vector3 normal; public static final String SERIALIZED_NAME_OFFSET = "offset"; @SerializedName(SERIALIZED_NAME_OFFSET) + @javax.annotation.Nonnull private BigDecimal offset; - public SectionPlane() { + public SectionPlane() { } - public SectionPlane normal(Vector3 normal) { - + public SectionPlane normal(@javax.annotation.Nonnull Vector3 normal) { this.normal = normal; return this; } - /** + /** * Get normal * @return normal - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Vector3 getNormal() { return normal; } - - public void setNormal(Vector3 normal) { + public void setNormal(@javax.annotation.Nonnull Vector3 normal) { this.normal = normal; } - public SectionPlane offset(BigDecimal offset) { - + public SectionPlane offset(@javax.annotation.Nonnull BigDecimal offset) { this.offset = offset; return this; } - /** + /** * Distance from the center point to move the plane. * @return offset - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "Distance from the center point to move the plane.") - public BigDecimal getOffset() { return offset; } - - public void setOffset(BigDecimal offset) { + public void setOffset(@javax.annotation.Nonnull BigDecimal offset) { this.offset = offset; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,101 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("normal"); + openapiFields.add("offset"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("normal"); + openapiRequiredFields.add("offset"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SectionPlane + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SectionPlane.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SectionPlane is not found in the empty JSON string", SectionPlane.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SectionPlane.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SectionPlane` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SectionPlane.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `normal` + Vector3.validateJsonElement(jsonObj.get("normal")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SectionPlane.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SectionPlane' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SectionPlane.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SectionPlane value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SectionPlane read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SectionPlane given an JSON string + * + * @param jsonString JSON string + * @return An instance of SectionPlane + * @throws IOException if the JSON string is invalid with respect to SectionPlane + */ + public static SectionPlane fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SectionPlane.class); + } + + /** + * Convert an instance of SectionPlane to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/SelectOp.java b/src/main/java/com/vertexvis/model/SelectOp.java index 9c896cc..0bfc28c 100644 --- a/src/main/java/com/vertexvis/model/SelectOp.java +++ b/src/main/java/com/vertexvis/model/SelectOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * SelectOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class SelectOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public SelectOp() { + public SelectOp() { } - public SelectOp type(TypeEnum type) { - + public SelectOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "select", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SelectOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SelectOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SelectOp is not found in the empty JSON string", SelectOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SelectOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SelectOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SelectOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SelectOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelectOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SelectOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SelectOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SelectOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SelectOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of SelectOp + * @throws IOException if the JSON string is invalid with respect to SelectOp + */ + public static SelectOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SelectOp.class); + } + + /** + * Convert an instance of SelectOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/StreamKey.java b/src/main/java/com/vertexvis/model/StreamKey.java index 169136f..e52fbc0 100644 --- a/src/main/java/com/vertexvis/model/StreamKey.java +++ b/src/main/java/com/vertexvis/model/StreamKey.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.StreamKeyData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * StreamKey */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class StreamKey { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private StreamKeyData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public StreamKey() { + public StreamKey() { } - public StreamKey data(StreamKeyData data) { - + public StreamKey data(@javax.annotation.Nonnull StreamKeyData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public StreamKeyData getData() { return data; } - - public void setData(StreamKeyData data) { + public void setData(@javax.annotation.Nonnull StreamKeyData data) { this.data = data; } - public StreamKey links(Map links) { - + public StreamKey links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public StreamKey putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StreamKey + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StreamKey.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StreamKey is not found in the empty JSON string", StreamKey.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StreamKey.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StreamKey` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StreamKey.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + StreamKeyData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamKey.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamKey' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StreamKey.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamKey value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StreamKey read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StreamKey given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamKey + * @throws IOException if the JSON string is invalid with respect to StreamKey + */ + public static StreamKey fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamKey.class); + } + + /** + * Convert an instance of StreamKey to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/StreamKeyData.java b/src/main/java/com/vertexvis/model/StreamKeyData.java index f6c7790..cbcef34 100644 --- a/src/main/java/com/vertexvis/model/StreamKeyData.java +++ b/src/main/java/com/vertexvis/model/StreamKeyData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.SceneViewDataRelationships; import com.vertexvis.model.StreamKeyDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * StreamKeyData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class StreamKeyData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private StreamKeyDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull private SceneViewDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public StreamKeyData() { + public StreamKeyData() { } - public StreamKeyData type(String type) { - + public StreamKeyData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "stream-key", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public StreamKeyData id(UUID id) { - + public StreamKeyData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public StreamKeyData attributes(StreamKeyDataAttributes attributes) { - + public StreamKeyData attributes(@javax.annotation.Nonnull StreamKeyDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public StreamKeyDataAttributes getAttributes() { return attributes; } - - public void setAttributes(StreamKeyDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull StreamKeyDataAttributes attributes) { this.attributes = attributes; } - public StreamKeyData relationships(SceneViewDataRelationships relationships) { - + public StreamKeyData relationships(@javax.annotation.Nonnull SceneViewDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public SceneViewDataRelationships getRelationships() { return relationships; } - - public void setRelationships(SceneViewDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nonnull SceneViewDataRelationships relationships) { this.relationships = relationships; } - public StreamKeyData links(Map links) { - + public StreamKeyData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public StreamKeyData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StreamKeyData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StreamKeyData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StreamKeyData is not found in the empty JSON string", StreamKeyData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StreamKeyData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StreamKeyData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StreamKeyData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + StreamKeyDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + SceneViewDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamKeyData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamKeyData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StreamKeyData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamKeyData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StreamKeyData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StreamKeyData given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamKeyData + * @throws IOException if the JSON string is invalid with respect to StreamKeyData + */ + public static StreamKeyData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamKeyData.class); + } + + /** + * Convert an instance of StreamKeyData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/StreamKeyDataAttributes.java b/src/main/java/com/vertexvis/model/StreamKeyDataAttributes.java index 574cb41..dfa3a5e 100644 --- a/src/main/java/com/vertexvis/model/StreamKeyDataAttributes.java +++ b/src/main/java/com/vertexvis/model/StreamKeyDataAttributes.java @@ -14,133 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * StreamKeyDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class StreamKeyDataAttributes { public static final String SERIALIZED_NAME_KEY = "key"; @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nullable private String key; public static final String SERIALIZED_NAME_EXPIRY = "expiry"; @SerializedName(SERIALIZED_NAME_EXPIRY) + @javax.annotation.Nonnull private Integer expiry; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS = "excludePrunedItems"; @SerializedName(SERIALIZED_NAME_EXCLUDE_PRUNED_ITEMS) + @javax.annotation.Nullable private Boolean excludePrunedItems; - public StreamKeyDataAttributes() { + public StreamKeyDataAttributes() { } - public StreamKeyDataAttributes key(String key) { - + public StreamKeyDataAttributes key(@javax.annotation.Nullable String key) { this.key = key; return this; } - /** + /** * Get key * @return key - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "i3MFRDOmg1pxD36dGCTONRwOujkgV8m9LQ", value = "") - public String getKey() { return key; } - - public void setKey(String key) { + public void setKey(@javax.annotation.Nullable String key) { this.key = key; } - public StreamKeyDataAttributes expiry(Integer expiry) { - + public StreamKeyDataAttributes expiry(@javax.annotation.Nonnull Integer expiry) { this.expiry = expiry; return this; } - /** + /** * Get expiry * @return expiry - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "600", required = true, value = "") - public Integer getExpiry() { return expiry; } - - public void setExpiry(Integer expiry) { + public void setExpiry(@javax.annotation.Nonnull Integer expiry) { this.expiry = expiry; } - public StreamKeyDataAttributes created(OffsetDateTime created) { - + public StreamKeyDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public StreamKeyDataAttributes excludePrunedItems(Boolean excludePrunedItems) { - + public StreamKeyDataAttributes excludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; return this; } - /** + /** * Get excludePrunedItems * @return excludePrunedItems - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - public Boolean getExcludePrunedItems() { return excludePrunedItems; } - - public void setExcludePrunedItems(Boolean excludePrunedItems) { + public void setExcludePrunedItems(@javax.annotation.Nullable Boolean excludePrunedItems) { this.excludePrunedItems = excludePrunedItems; } + @Override public boolean equals(Object o) { if (this == o) { @@ -184,5 +194,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("expiry"); + openapiFields.add("created"); + openapiFields.add("excludePrunedItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("expiry"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StreamKeyDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StreamKeyDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StreamKeyDataAttributes is not found in the empty JSON string", StreamKeyDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StreamKeyDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StreamKeyDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StreamKeyDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamKeyDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamKeyDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StreamKeyDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamKeyDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StreamKeyDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StreamKeyDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamKeyDataAttributes + * @throws IOException if the JSON string is invalid with respect to StreamKeyDataAttributes + */ + public static StreamKeyDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamKeyDataAttributes.class); + } + + /** + * Convert an instance of StreamKeyDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/StreamKeyList.java b/src/main/java/com/vertexvis/model/StreamKeyList.java index d32d44c..f1d7914 100644 --- a/src/main/java/com/vertexvis/model/StreamKeyList.java +++ b/src/main/java/com/vertexvis/model/StreamKeyList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.StreamKeyData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * StreamKeyList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class StreamKeyList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public StreamKeyList() { + public StreamKeyList() { } - public StreamKeyList data(List data) { - + public StreamKeyList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public StreamKeyList addDataItem(StreamKeyData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public StreamKeyList links(Map links) { - + public StreamKeyList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public StreamKeyList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StreamKeyList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StreamKeyList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StreamKeyList is not found in the empty JSON string", StreamKeyList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StreamKeyList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StreamKeyList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StreamKeyList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + StreamKeyData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamKeyList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamKeyList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StreamKeyList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamKeyList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StreamKeyList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StreamKeyList given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamKeyList + * @throws IOException if the JSON string is invalid with respect to StreamKeyList + */ + public static StreamKeyList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamKeyList.class); + } + + /** + * Convert an instance of StreamKeyList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ThumbnailData.java b/src/main/java/com/vertexvis/model/ThumbnailData.java index a18b1b1..f9b926e 100644 --- a/src/main/java/com/vertexvis/model/ThumbnailData.java +++ b/src/main/java/com/vertexvis/model/ThumbnailData.java @@ -14,105 +14,118 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ThumbnailData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ThumbnailData { public static final String SERIALIZED_NAME_URI = "uri"; @SerializedName(SERIALIZED_NAME_URI) + @javax.annotation.Nonnull private String uri; public static final String SERIALIZED_NAME_HEIGHT = "height"; @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nonnull private Integer height; public static final String SERIALIZED_NAME_WIDTH = "width"; @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nonnull private Integer width; - public ThumbnailData() { + public ThumbnailData() { } - public ThumbnailData uri(String uri) { - + public ThumbnailData uri(@javax.annotation.Nonnull String uri) { this.uri = uri; return this; } - /** + /** * Get uri * @return uri - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public String getUri() { return uri; } - - public void setUri(String uri) { + public void setUri(@javax.annotation.Nonnull String uri) { this.uri = uri; } - public ThumbnailData height(Integer height) { - + public ThumbnailData height(@javax.annotation.Nonnull Integer height) { this.height = height; return this; } - /** + /** * Get height * @return height - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Integer getHeight() { return height; } - - public void setHeight(Integer height) { + public void setHeight(@javax.annotation.Nonnull Integer height) { this.height = height; } - public ThumbnailData width(Integer width) { - + public ThumbnailData width(@javax.annotation.Nonnull Integer width) { this.width = width; return this; } - /** + /** * Get width * @return width - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Integer getWidth() { return width; } - - public void setWidth(Integer width) { + public void setWidth(@javax.annotation.Nonnull Integer width) { this.width = width; } + @Override public boolean equals(Object o) { if (this == o) { @@ -154,5 +167,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uri"); + openapiFields.add("height"); + openapiFields.add("width"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("uri"); + openapiRequiredFields.add("height"); + openapiRequiredFields.add("width"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThumbnailData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThumbnailData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThumbnailData is not found in the empty JSON string", ThumbnailData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThumbnailData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThumbnailData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ThumbnailData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("uri").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uri` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uri").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThumbnailData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThumbnailData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThumbnailData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThumbnailData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThumbnailData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThumbnailData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThumbnailData + * @throws IOException if the JSON string is invalid with respect to ThumbnailData + */ + public static ThumbnailData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThumbnailData.class); + } + + /** + * Convert an instance of ThumbnailData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/TranslationInspectionJob.java b/src/main/java/com/vertexvis/model/TranslationInspectionJob.java index 62d4f07..05ceb62 100644 --- a/src/main/java/com/vertexvis/model/TranslationInspectionJob.java +++ b/src/main/java/com/vertexvis/model/TranslationInspectionJob.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.TranslationInspectionJobData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * TranslationInspectionJob */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class TranslationInspectionJob { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private TranslationInspectionJobData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public TranslationInspectionJob() { + public TranslationInspectionJob() { } - public TranslationInspectionJob data(TranslationInspectionJobData data) { - + public TranslationInspectionJob data(@javax.annotation.Nonnull TranslationInspectionJobData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public TranslationInspectionJobData getData() { return data; } - - public void setData(TranslationInspectionJobData data) { + public void setData(@javax.annotation.Nonnull TranslationInspectionJobData data) { this.data = data; } - public TranslationInspectionJob links(Map links) { - + public TranslationInspectionJob links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public TranslationInspectionJob putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranslationInspectionJob + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranslationInspectionJob.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranslationInspectionJob is not found in the empty JSON string", TranslationInspectionJob.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TranslationInspectionJob.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TranslationInspectionJob` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TranslationInspectionJob.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + TranslationInspectionJobData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranslationInspectionJob.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranslationInspectionJob' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranslationInspectionJob.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranslationInspectionJob value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TranslationInspectionJob read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranslationInspectionJob given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranslationInspectionJob + * @throws IOException if the JSON string is invalid with respect to TranslationInspectionJob + */ + public static TranslationInspectionJob fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranslationInspectionJob.class); + } + + /** + * Convert an instance of TranslationInspectionJob to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/TranslationInspectionJobData.java b/src/main/java/com/vertexvis/model/TranslationInspectionJobData.java index 63e28ea..f4f95fb 100644 --- a/src/main/java/com/vertexvis/model/TranslationInspectionJobData.java +++ b/src/main/java/com/vertexvis/model/TranslationInspectionJobData.java @@ -14,107 +14,120 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.TranslationInspectionJobDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * TranslationInspectionJobData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class TranslationInspectionJobData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private TranslationInspectionJobDataAttributes attributes; - public TranslationInspectionJobData() { + public TranslationInspectionJobData() { } - public TranslationInspectionJobData type(String type) { - + public TranslationInspectionJobData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "translation-inspection", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public TranslationInspectionJobData id(UUID id) { - + public TranslationInspectionJobData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public TranslationInspectionJobData attributes(TranslationInspectionJobDataAttributes attributes) { - + public TranslationInspectionJobData attributes(@javax.annotation.Nonnull TranslationInspectionJobDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public TranslationInspectionJobDataAttributes getAttributes() { return attributes; } - - public void setAttributes(TranslationInspectionJobDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull TranslationInspectionJobDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranslationInspectionJobData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranslationInspectionJobData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranslationInspectionJobData is not found in the empty JSON string", TranslationInspectionJobData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TranslationInspectionJobData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TranslationInspectionJobData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TranslationInspectionJobData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + TranslationInspectionJobDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranslationInspectionJobData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranslationInspectionJobData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranslationInspectionJobData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranslationInspectionJobData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TranslationInspectionJobData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranslationInspectionJobData given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranslationInspectionJobData + * @throws IOException if the JSON string is invalid with respect to TranslationInspectionJobData + */ + public static TranslationInspectionJobData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranslationInspectionJobData.class); + } + + /** + * Convert an instance of TranslationInspectionJobData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/TranslationInspectionJobDataAttributes.java b/src/main/java/com/vertexvis/model/TranslationInspectionJobDataAttributes.java index a226d4e..594cc37 100644 --- a/src/main/java/com/vertexvis/model/TranslationInspectionJobDataAttributes.java +++ b/src/main/java/com/vertexvis/model/TranslationInspectionJobDataAttributes.java @@ -14,85 +14,104 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * TranslationInspectionJobDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class TranslationInspectionJobDataAttributes { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private String status; public static final String SERIALIZED_NAME_MISSING = "missing"; @SerializedName(SERIALIZED_NAME_MISSING) + @javax.annotation.Nonnull private List missing = new ArrayList<>(); - public TranslationInspectionJobDataAttributes() { + public TranslationInspectionJobDataAttributes() { } - public TranslationInspectionJobDataAttributes status(String status) { - + public TranslationInspectionJobDataAttributes status(@javax.annotation.Nonnull String status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "running", required = true, value = "") - public String getStatus() { return status; } - - public void setStatus(String status) { + public void setStatus(@javax.annotation.Nonnull String status) { this.status = status; } - public TranslationInspectionJobDataAttributes missing(List missing) { - + public TranslationInspectionJobDataAttributes missing(@javax.annotation.Nonnull List missing) { this.missing = missing; return this; } public TranslationInspectionJobDataAttributes addMissingItem(String missingItem) { + if (this.missing == null) { + this.missing = new ArrayList<>(); + } this.missing.add(missingItem); return this; } - /** + /** * Get missing * @return missing - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getMissing() { return missing; } - - public void setMissing(List missing) { + public void setMissing(@javax.annotation.Nonnull List missing) { this.missing = missing; } + @Override public boolean equals(Object o) { if (this == o) { @@ -132,5 +151,108 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("missing"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("missing"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranslationInspectionJobDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranslationInspectionJobDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranslationInspectionJobDataAttributes is not found in the empty JSON string", TranslationInspectionJobDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TranslationInspectionJobDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TranslationInspectionJobDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TranslationInspectionJobDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // ensure the required json array is present + if (jsonObj.get("missing") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("missing").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `missing` to be an array in the JSON string but got `%s`", jsonObj.get("missing").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranslationInspectionJobDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranslationInspectionJobDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranslationInspectionJobDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranslationInspectionJobDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TranslationInspectionJobDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranslationInspectionJobDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranslationInspectionJobDataAttributes + * @throws IOException if the JSON string is invalid with respect to TranslationInspectionJobDataAttributes + */ + public static TranslationInspectionJobDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranslationInspectionJobDataAttributes.class); + } + + /** + * Convert an instance of TranslationInspectionJobDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateAccountRequest.java b/src/main/java/com/vertexvis/model/UpdateAccountRequest.java index 046b421..5e7fc65 100644 --- a/src/main/java/com/vertexvis/model/UpdateAccountRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateAccountRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateAccountRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateAccountRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateAccountRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateAccountRequestData data; - public UpdateAccountRequest() { + public UpdateAccountRequest() { } - public UpdateAccountRequest data(UpdateAccountRequestData data) { - + public UpdateAccountRequest data(@javax.annotation.Nonnull UpdateAccountRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateAccountRequestData getData() { return data; } - - public void setData(UpdateAccountRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateAccountRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateAccountRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAccountRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAccountRequest is not found in the empty JSON string", UpdateAccountRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAccountRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAccountRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAccountRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateAccountRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAccountRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAccountRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAccountRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAccountRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAccountRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAccountRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAccountRequest + * @throws IOException if the JSON string is invalid with respect to UpdateAccountRequest + */ + public static UpdateAccountRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAccountRequest.class); + } + + /** + * Convert an instance of UpdateAccountRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateAccountRequestData.java b/src/main/java/com/vertexvis/model/UpdateAccountRequestData.java index 359ffc8..c8fb95d 100644 --- a/src/main/java/com/vertexvis/model/UpdateAccountRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateAccountRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateAccountRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateAccountRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateAccountRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateAccountRequestDataAttributes attributes; - public UpdateAccountRequestData() { + public UpdateAccountRequestData() { } - public UpdateAccountRequestData type(String type) { - + public UpdateAccountRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "account", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateAccountRequestData attributes(UpdateAccountRequestDataAttributes attributes) { - + public UpdateAccountRequestData attributes(@javax.annotation.Nonnull UpdateAccountRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateAccountRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateAccountRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateAccountRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateAccountRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAccountRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAccountRequestData is not found in the empty JSON string", UpdateAccountRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAccountRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAccountRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAccountRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAccountRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAccountRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAccountRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAccountRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAccountRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAccountRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAccountRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateAccountRequestData + */ + public static UpdateAccountRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAccountRequestData.class); + } + + /** + * Convert an instance of UpdateAccountRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateAccountRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateAccountRequestDataAttributes.java index 17887d8..9c36479 100644 --- a/src/main/java/com/vertexvis/model/UpdateAccountRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateAccountRequestDataAttributes.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateAccountRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateAccountRequestDataAttributes { /** * Gets or Sets status @@ -74,92 +95,89 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { return StatusEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private StatusEnum status; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_OWNER = "owner"; @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable private String owner; - public UpdateAccountRequestDataAttributes() { + public UpdateAccountRequestDataAttributes() { } - public UpdateAccountRequestDataAttributes status(StatusEnum status) { - + public UpdateAccountRequestDataAttributes status(@javax.annotation.Nullable StatusEnum status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "active", value = "") - public StatusEnum getStatus() { return status; } - - public void setStatus(StatusEnum status) { + public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } - public UpdateAccountRequestDataAttributes name(String name) { - + public UpdateAccountRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public UpdateAccountRequestDataAttributes owner(String owner) { - + public UpdateAccountRequestDataAttributes owner(@javax.annotation.Nullable String owner) { this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getOwner() { return owner; } - - public void setOwner(String owner) { + public void setOwner(@javax.annotation.Nullable String owner) { this.owner = owner; } + @Override public boolean equals(Object o) { if (this == o) { @@ -201,5 +219,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("name"); + openapiFields.add("owner"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateAccountRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAccountRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAccountRequestDataAttributes is not found in the empty JSON string", UpdateAccountRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAccountRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAccountRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAccountRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAccountRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAccountRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAccountRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAccountRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAccountRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAccountRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateAccountRequestDataAttributes + */ + public static UpdateAccountRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAccountRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateAccountRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateApplicationRequest.java b/src/main/java/com/vertexvis/model/UpdateApplicationRequest.java index 0db57b0..6603004 100644 --- a/src/main/java/com/vertexvis/model/UpdateApplicationRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateApplicationRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateApplicationRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateApplicationRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateApplicationRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateApplicationRequestData data; - public UpdateApplicationRequest() { + public UpdateApplicationRequest() { } - public UpdateApplicationRequest data(UpdateApplicationRequestData data) { - + public UpdateApplicationRequest data(@javax.annotation.Nonnull UpdateApplicationRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateApplicationRequestData getData() { return data; } - - public void setData(UpdateApplicationRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateApplicationRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateApplicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateApplicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateApplicationRequest is not found in the empty JSON string", UpdateApplicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateApplicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateApplicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateApplicationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateApplicationRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateApplicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateApplicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateApplicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateApplicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateApplicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateApplicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateApplicationRequest + * @throws IOException if the JSON string is invalid with respect to UpdateApplicationRequest + */ + public static UpdateApplicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateApplicationRequest.class); + } + + /** + * Convert an instance of UpdateApplicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateApplicationRequestData.java b/src/main/java/com/vertexvis/model/UpdateApplicationRequestData.java index 4346b80..67f621b 100644 --- a/src/main/java/com/vertexvis/model/UpdateApplicationRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateApplicationRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateApplicationRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateApplicationRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateApplicationRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateApplicationRequestDataAttributes attributes; - public UpdateApplicationRequestData() { + public UpdateApplicationRequestData() { } - public UpdateApplicationRequestData type(String type) { - + public UpdateApplicationRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "application", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateApplicationRequestData attributes(UpdateApplicationRequestDataAttributes attributes) { - + public UpdateApplicationRequestData attributes(@javax.annotation.Nonnull UpdateApplicationRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateApplicationRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateApplicationRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateApplicationRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateApplicationRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateApplicationRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateApplicationRequestData is not found in the empty JSON string", UpdateApplicationRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateApplicationRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateApplicationRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateApplicationRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateApplicationRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateApplicationRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateApplicationRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateApplicationRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateApplicationRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateApplicationRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateApplicationRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateApplicationRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateApplicationRequestData + */ + public static UpdateApplicationRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateApplicationRequestData.class); + } + + /** + * Convert an instance of UpdateApplicationRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateApplicationRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateApplicationRequestDataAttributes.java index 12c5bf7..fa4537f 100644 --- a/src/main/java/com/vertexvis/model/UpdateApplicationRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateApplicationRequestDataAttributes.java @@ -14,59 +14,77 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateApplicationRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateApplicationRequestDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_REDIRECT_URIS = "redirect_uris"; @SerializedName(SERIALIZED_NAME_REDIRECT_URIS) - private List redirectUris = null; + @javax.annotation.Nullable + private List redirectUris = new ArrayList<>(); - public UpdateApplicationRequestDataAttributes() { + public UpdateApplicationRequestDataAttributes() { } - public UpdateApplicationRequestDataAttributes name(String name) { - + public UpdateApplicationRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public UpdateApplicationRequestDataAttributes redirectUris(List redirectUris) { - + public UpdateApplicationRequestDataAttributes redirectUris(@javax.annotation.Nullable List redirectUris) { this.redirectUris = redirectUris; return this; } @@ -79,23 +97,21 @@ public UpdateApplicationRequestDataAttributes addRedirectUrisItem(String redirec return this; } - /** + /** * Get redirectUris * @return redirectUris - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getRedirectUris() { return redirectUris; } - - public void setRedirectUris(List redirectUris) { + public void setRedirectUris(@javax.annotation.Nullable List redirectUris) { this.redirectUris = redirectUris; } + @Override public boolean equals(Object o) { if (this == o) { @@ -135,5 +151,97 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("redirect_uris"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateApplicationRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateApplicationRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateApplicationRequestDataAttributes is not found in the empty JSON string", UpdateApplicationRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateApplicationRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateApplicationRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("redirect_uris") != null && !jsonObj.get("redirect_uris").isJsonNull() && !jsonObj.get("redirect_uris").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `redirect_uris` to be an array in the JSON string but got `%s`", jsonObj.get("redirect_uris").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateApplicationRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateApplicationRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateApplicationRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateApplicationRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateApplicationRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateApplicationRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateApplicationRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateApplicationRequestDataAttributes + */ + public static UpdateApplicationRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateApplicationRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateApplicationRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateFileRequest.java b/src/main/java/com/vertexvis/model/UpdateFileRequest.java new file mode 100644 index 0000000..ce2d9cc --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateFileRequest.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpdateFileRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateFileRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateFileRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private UpdateFileRequestData data; + + public UpdateFileRequest() { + } + + public UpdateFileRequest data(@javax.annotation.Nonnull UpdateFileRequestData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public UpdateFileRequestData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull UpdateFileRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFileRequest updateFileRequest = (UpdateFileRequest) o; + return Objects.equals(this.data, updateFileRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFileRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFileRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFileRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFileRequest is not found in the empty JSON string", UpdateFileRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFileRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFileRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFileRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateFileRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFileRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFileRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFileRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFileRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFileRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFileRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFileRequest + * @throws IOException if the JSON string is invalid with respect to UpdateFileRequest + */ + public static UpdateFileRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFileRequest.class); + } + + /** + * Convert an instance of UpdateFileRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateFileRequestData.java b/src/main/java/com/vertexvis/model/UpdateFileRequestData.java new file mode 100644 index 0000000..cb091e0 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateFileRequestData.java @@ -0,0 +1,245 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpdateFileRequestDataAttributes; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateFileRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateFileRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private UpdateFileRequestDataAttributes attributes; + + public UpdateFileRequestData() { + } + + public UpdateFileRequestData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public UpdateFileRequestData attributes(@javax.annotation.Nonnull UpdateFileRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public UpdateFileRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull UpdateFileRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFileRequestData updateFileRequestData = (UpdateFileRequestData) o; + return Objects.equals(this.type, updateFileRequestData.type) && + Objects.equals(this.attributes, updateFileRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFileRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFileRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFileRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFileRequestData is not found in the empty JSON string", UpdateFileRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFileRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFileRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFileRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateFileRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFileRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFileRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFileRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFileRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFileRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFileRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFileRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateFileRequestData + */ + public static UpdateFileRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFileRequestData.class); + } + + /** + * Convert an instance of UpdateFileRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateFileRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateFileRequestDataAttributes.java new file mode 100644 index 0000000..1f27f50 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateFileRequestDataAttributes.java @@ -0,0 +1,216 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateFileRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateFileRequestDataAttributes { + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + @SerializedName(SERIALIZED_NAME_EXPIRY) + @javax.annotation.Nullable + private Integer expiry; + + public UpdateFileRequestDataAttributes() { + } + + public UpdateFileRequestDataAttributes expiry(@javax.annotation.Nullable Integer expiry) { + this.expiry = expiry; + return this; + } + + /** + * Number of seconds before the file is deleted. + * minimum: 1 + * @return expiry + */ + @javax.annotation.Nullable + public Integer getExpiry() { + return expiry; + } + + public void setExpiry(@javax.annotation.Nullable Integer expiry) { + this.expiry = expiry; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFileRequestDataAttributes updateFileRequestDataAttributes = (UpdateFileRequestDataAttributes) o; + return Objects.equals(this.expiry, updateFileRequestDataAttributes.expiry); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(expiry); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFileRequestDataAttributes {\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiry"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFileRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFileRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFileRequestDataAttributes is not found in the empty JSON string", UpdateFileRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFileRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFileRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFileRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFileRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFileRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFileRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFileRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFileRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFileRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateFileRequestDataAttributes + */ + public static UpdateFileRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFileRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateFileRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateItemToDefaultRenditionOperation.java b/src/main/java/com/vertexvis/model/UpdateItemToDefaultRenditionOperation.java index 544263b..f57d57d 100644 --- a/src/main/java/com/vertexvis/model/UpdateItemToDefaultRenditionOperation.java +++ b/src/main/java/com/vertexvis/model/UpdateItemToDefaultRenditionOperation.java @@ -14,22 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * An operation that updates items with the specified revision to the default rendition. */ -@ApiModel(description = "An operation that updates items with the specified revision to the default rendition.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateItemToDefaultRenditionOperation { /** * Gets or Sets type @@ -74,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_REVISION_ID = "revisionId"; @SerializedName(SERIALIZED_NAME_REVISION_ID) + @javax.annotation.Nonnull private UUID revisionId; - public UpdateItemToDefaultRenditionOperation() { + public UpdateItemToDefaultRenditionOperation() { } - public UpdateItemToDefaultRenditionOperation type(TypeEnum type) { - + public UpdateItemToDefaultRenditionOperation type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "update-to-default-rendition", required = true, value = "") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public UpdateItemToDefaultRenditionOperation revisionId(UUID revisionId) { - + public UpdateItemToDefaultRenditionOperation revisionId(@javax.annotation.Nonnull UUID revisionId) { this.revisionId = revisionId; return this; } - /** + /** * ID of the resource. * @return revisionId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getRevisionId() { return revisionId; } - - public void setRevisionId(UUID revisionId) { + public void setRevisionId(@javax.annotation.Nonnull UUID revisionId) { this.revisionId = revisionId; } + @Override public boolean equals(Object o) { if (this == o) { @@ -172,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("revisionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("revisionId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateItemToDefaultRenditionOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateItemToDefaultRenditionOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateItemToDefaultRenditionOperation is not found in the empty JSON string", UpdateItemToDefaultRenditionOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateItemToDefaultRenditionOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateItemToDefaultRenditionOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateItemToDefaultRenditionOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("revisionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revisionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revisionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateItemToDefaultRenditionOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateItemToDefaultRenditionOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateItemToDefaultRenditionOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateItemToDefaultRenditionOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateItemToDefaultRenditionOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateItemToDefaultRenditionOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateItemToDefaultRenditionOperation + * @throws IOException if the JSON string is invalid with respect to UpdateItemToDefaultRenditionOperation + */ + public static UpdateItemToDefaultRenditionOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateItemToDefaultRenditionOperation.class); + } + + /** + * Convert an instance of UpdateItemToDefaultRenditionOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequest.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequest.java index b3c868f..6918afb 100644 --- a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequest.java +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdatePartRevisionRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdatePartRevisionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdatePartRevisionRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdatePartRevisionRequestData data; - public UpdatePartRevisionRequest() { + public UpdatePartRevisionRequest() { } - public UpdatePartRevisionRequest data(UpdatePartRevisionRequestData data) { - + public UpdatePartRevisionRequest data(@javax.annotation.Nonnull UpdatePartRevisionRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdatePartRevisionRequestData getData() { return data; } - - public void setData(UpdatePartRevisionRequestData data) { + public void setData(@javax.annotation.Nonnull UpdatePartRevisionRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePartRevisionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePartRevisionRequest is not found in the empty JSON string", UpdatePartRevisionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePartRevisionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePartRevisionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdatePartRevisionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdatePartRevisionRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePartRevisionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePartRevisionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePartRevisionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePartRevisionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePartRevisionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePartRevisionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePartRevisionRequest + * @throws IOException if the JSON string is invalid with respect to UpdatePartRevisionRequest + */ + public static UpdatePartRevisionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePartRevisionRequest.class); + } + + /** + * Convert an instance of UpdatePartRevisionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestData.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestData.java index 4ab7fdb..503e011 100644 --- a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestData.java @@ -14,136 +14,145 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.CreateGeometrySetRequestDataRelationships; import com.vertexvis.model.UpdatePartRevisionRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataRelationships; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * Modify existing part revisions using this endpoint. When specifying a `relationship`, the generated output from that relationship will be used to replace any relationship that is present on the revision prior to the update. For example, sending a file relationship that has geometry will replace the existing geometry on the revision with the new geometry in the given file. */ -@ApiModel(description = "Modify existing part revisions using this endpoint. When specifying a `relationship`, the generated output from that relationship will be used to replace any relationship that is present on the revision prior to the update. For example, sending a file relationship that has geometry will replace the existing geometry on the revision with the new geometry in the given file. ") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdatePartRevisionRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdatePartRevisionRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) - private CreateGeometrySetRequestDataRelationships relationships; + @javax.annotation.Nullable + private UpdatePartRevisionRequestDataRelationships relationships; - public UpdatePartRevisionRequestData() { + public UpdatePartRevisionRequestData() { } - public UpdatePartRevisionRequestData type(String type) { - + public UpdatePartRevisionRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-revision", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdatePartRevisionRequestData id(UUID id) { - + public UpdatePartRevisionRequestData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public UpdatePartRevisionRequestData attributes(UpdatePartRevisionRequestDataAttributes attributes) { - + public UpdatePartRevisionRequestData attributes(@javax.annotation.Nonnull UpdatePartRevisionRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdatePartRevisionRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdatePartRevisionRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdatePartRevisionRequestDataAttributes attributes) { this.attributes = attributes; } - public UpdatePartRevisionRequestData relationships(CreateGeometrySetRequestDataRelationships relationships) { - + public UpdatePartRevisionRequestData relationships(@javax.annotation.Nullable UpdatePartRevisionRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateGeometrySetRequestDataRelationships getRelationships() { + public UpdatePartRevisionRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(CreateGeometrySetRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable UpdatePartRevisionRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -187,5 +196,114 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePartRevisionRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePartRevisionRequestData is not found in the empty JSON string", UpdatePartRevisionRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePartRevisionRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePartRevisionRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdatePartRevisionRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + UpdatePartRevisionRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + UpdatePartRevisionRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePartRevisionRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePartRevisionRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePartRevisionRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePartRevisionRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePartRevisionRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePartRevisionRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePartRevisionRequestData + * @throws IOException if the JSON string is invalid with respect to UpdatePartRevisionRequestData + */ + public static UpdatePartRevisionRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePartRevisionRequestData.class); + } + + /** + * Convert an instance of UpdatePartRevisionRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributes.java index 9b8b5e8..f88f9e5 100644 --- a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributes.java @@ -14,59 +14,84 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdatePartRevisionRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdatePartRevisionRequestDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_INDEX_METADATA = "indexMetadata"; @SerializedName(SERIALIZED_NAME_INDEX_METADATA) + @javax.annotation.Nullable private Boolean indexMetadata; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID_KEY = "suppliedIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID_KEY) + @javax.annotation.Nullable private String suppliedIdKey; public static final String SERIALIZED_NAME_SUPPLIED_REVISION_ID_KEY = "suppliedRevisionIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_REVISION_ID_KEY) + @javax.annotation.Nullable private String suppliedRevisionIdKey; public static final String SERIALIZED_NAME_SUPPLIED_INSTANCE_ID_KEY = "suppliedInstanceIdKey"; @SerializedName(SERIALIZED_NAME_SUPPLIED_INSTANCE_ID_KEY) + @javax.annotation.Nullable private String suppliedInstanceIdKey; - public UpdatePartRevisionRequestDataAttributes() { + public UpdatePartRevisionRequestDataAttributes() { } - public UpdatePartRevisionRequestDataAttributes metadata(Map metadata) { - + public UpdatePartRevisionRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public UpdatePartRevisionRequestDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public UpdatePartRevisionRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -74,138 +99,116 @@ public UpdatePartRevisionRequestDataAttributes putMetadataItem(String key, AnyOf return this; } - /** + /** * Metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. ") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } - public UpdatePartRevisionRequestDataAttributes indexMetadata(Boolean indexMetadata) { - + public UpdatePartRevisionRequestDataAttributes indexMetadata(@javax.annotation.Nullable Boolean indexMetadata) { this.indexMetadata = indexMetadata; return this; } - /** + /** * Whether or not to index metadata in the part file when sending a file relationship - not used otherwise. To ignore metadata from the part file and add your own, pass `false` for `indexMetadata` and supply custom metadata using the `metadata` field. * @return indexMetadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "false", value = "Whether or not to index metadata in the part file when sending a file relationship - not used otherwise. To ignore metadata from the part file and add your own, pass `false` for `indexMetadata` and supply custom metadata using the `metadata` field. ") - public Boolean getIndexMetadata() { return indexMetadata; } - - public void setIndexMetadata(Boolean indexMetadata) { + public void setIndexMetadata(@javax.annotation.Nullable Boolean indexMetadata) { this.indexMetadata = indexMetadata; } - public UpdatePartRevisionRequestDataAttributes name(String name) { - + public UpdatePartRevisionRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Name to be used for the root part. This will be used when given a file relationship - not used otherwise. * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "1/2in. Flat Washer", value = "Name to be used for the root part. This will be used when given a file relationship - not used otherwise.") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public UpdatePartRevisionRequestDataAttributes suppliedIdKey(String suppliedIdKey) { - + public UpdatePartRevisionRequestDataAttributes suppliedIdKey(@javax.annotation.Nullable String suppliedIdKey) { this.suppliedIdKey = suppliedIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise. * @return suppliedIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "ProductNumber", value = "Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise.") - public String getSuppliedIdKey() { return suppliedIdKey; } - - public void setSuppliedIdKey(String suppliedIdKey) { + public void setSuppliedIdKey(@javax.annotation.Nullable String suppliedIdKey) { this.suppliedIdKey = suppliedIdKey; } - public UpdatePartRevisionRequestDataAttributes suppliedRevisionIdKey(String suppliedRevisionIdKey) { - + public UpdatePartRevisionRequestDataAttributes suppliedRevisionIdKey(@javax.annotation.Nullable String suppliedRevisionIdKey) { this.suppliedRevisionIdKey = suppliedRevisionIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise. * @return suppliedRevisionIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "RevisionId", value = "Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise.") - public String getSuppliedRevisionIdKey() { return suppliedRevisionIdKey; } - - public void setSuppliedRevisionIdKey(String suppliedRevisionIdKey) { + public void setSuppliedRevisionIdKey(@javax.annotation.Nullable String suppliedRevisionIdKey) { this.suppliedRevisionIdKey = suppliedRevisionIdKey; } - public UpdatePartRevisionRequestDataAttributes suppliedInstanceIdKey(String suppliedInstanceIdKey) { - + public UpdatePartRevisionRequestDataAttributes suppliedInstanceIdKey(@javax.annotation.Nullable String suppliedInstanceIdKey) { this.suppliedInstanceIdKey = suppliedInstanceIdKey; return this; } - /** + /** * Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise. * @return suppliedInstanceIdKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "InstanceId", value = "Metadata key used to extract an ID used for correlation. This will be used when given a file relationship - not used otherwise.") - public String getSuppliedInstanceIdKey() { return suppliedInstanceIdKey; } - - public void setSuppliedInstanceIdKey(String suppliedInstanceIdKey) { + public void setSuppliedInstanceIdKey(@javax.annotation.Nullable String suppliedInstanceIdKey) { this.suppliedInstanceIdKey = suppliedInstanceIdKey; } + @Override public boolean equals(Object o) { if (this == o) { @@ -253,5 +256,106 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metadata"); + openapiFields.add("indexMetadata"); + openapiFields.add("name"); + openapiFields.add("suppliedIdKey"); + openapiFields.add("suppliedRevisionIdKey"); + openapiFields.add("suppliedInstanceIdKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePartRevisionRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePartRevisionRequestDataAttributes is not found in the empty JSON string", UpdatePartRevisionRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePartRevisionRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePartRevisionRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedIdKey") != null && !jsonObj.get("suppliedIdKey").isJsonNull()) && !jsonObj.get("suppliedIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedIdKey").toString())); + } + if ((jsonObj.get("suppliedRevisionIdKey") != null && !jsonObj.get("suppliedRevisionIdKey").isJsonNull()) && !jsonObj.get("suppliedRevisionIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedRevisionIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedRevisionIdKey").toString())); + } + if ((jsonObj.get("suppliedInstanceIdKey") != null && !jsonObj.get("suppliedInstanceIdKey").isJsonNull()) && !jsonObj.get("suppliedInstanceIdKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedInstanceIdKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedInstanceIdKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePartRevisionRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePartRevisionRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePartRevisionRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePartRevisionRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePartRevisionRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePartRevisionRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePartRevisionRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdatePartRevisionRequestDataAttributes + */ + public static UpdatePartRevisionRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePartRevisionRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdatePartRevisionRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java new file mode 100644 index 0000000..e4082e4 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java @@ -0,0 +1,405 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.MetadataDateType; +import com.vertexvis.model.MetadataFloatType; +import com.vertexvis.model.MetadataLongType; +import com.vertexvis.model.MetadataNullType; +import com.vertexvis.model.MetadataStringType; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdatePartRevisionRequestDataAttributesMetadataValue extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdatePartRevisionRequestDataAttributesMetadataValue.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePartRevisionRequestDataAttributesMetadataValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePartRevisionRequestDataAttributesMetadataValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterMetadataLongType = gson.getDelegateAdapter(this, TypeToken.get(MetadataLongType.class)); + final TypeAdapter adapterMetadataFloatType = gson.getDelegateAdapter(this, TypeToken.get(MetadataFloatType.class)); + final TypeAdapter adapterMetadataDateType = gson.getDelegateAdapter(this, TypeToken.get(MetadataDateType.class)); + final TypeAdapter adapterMetadataStringType = gson.getDelegateAdapter(this, TypeToken.get(MetadataStringType.class)); + final TypeAdapter adapterMetadataNullType = gson.getDelegateAdapter(this, TypeToken.get(MetadataNullType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePartRevisionRequestDataAttributesMetadataValue value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `MetadataLongType` + if (value.getActualInstance() instanceof MetadataLongType) { + JsonElement element = adapterMetadataLongType.toJsonTree((MetadataLongType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataFloatType` + if (value.getActualInstance() instanceof MetadataFloatType) { + JsonElement element = adapterMetadataFloatType.toJsonTree((MetadataFloatType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataDateType` + if (value.getActualInstance() instanceof MetadataDateType) { + JsonElement element = adapterMetadataDateType.toJsonTree((MetadataDateType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataStringType` + if (value.getActualInstance() instanceof MetadataStringType) { + JsonElement element = adapterMetadataStringType.toJsonTree((MetadataStringType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataNullType` + if (value.getActualInstance() instanceof MetadataNullType) { + JsonElement element = adapterMetadataNullType.toJsonTree((MetadataNullType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); + } + + @Override + public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize MetadataLongType + try { + // validate the JSON object to see if any exception is thrown + MetadataLongType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataLongType; + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataLongType'", e); + } + // deserialize MetadataFloatType + try { + // validate the JSON object to see if any exception is thrown + MetadataFloatType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataFloatType; + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataFloatType'", e); + } + // deserialize MetadataDateType + try { + // validate the JSON object to see if any exception is thrown + MetadataDateType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataDateType; + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataDateType'", e); + } + // deserialize MetadataStringType + try { + // validate the JSON object to see if any exception is thrown + MetadataStringType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataStringType; + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataStringType'", e); + } + // deserialize MetadataNullType + try { + // validate the JSON object to see if any exception is thrown + MetadataNullType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataNullType; + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataNullType'", e); + } + + throw new IOException(String.format("Failed deserialization for UpdatePartRevisionRequestDataAttributesMetadataValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public UpdatePartRevisionRequestDataAttributesMetadataValue() { + super("anyOf", Boolean.FALSE); + } + + public UpdatePartRevisionRequestDataAttributesMetadataValue(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("MetadataLongType", MetadataLongType.class); + schemas.put("MetadataFloatType", MetadataFloatType.class); + schemas.put("MetadataDateType", MetadataDateType.class); + schemas.put("MetadataStringType", MetadataStringType.class); + schemas.put("MetadataNullType", MetadataNullType.class); + } + + @Override + public Map> getSchemas() { + return UpdatePartRevisionRequestDataAttributesMetadataValue.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof MetadataLongType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataFloatType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataDateType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataStringType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataNullType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); + } + + /** + * Get the actual instance, which can be the following: + * MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType + * + * @return The actual instance (MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataLongType`. If the actual instance is not `MetadataLongType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataLongType` + * @throws ClassCastException if the instance is not `MetadataLongType` + */ + public MetadataLongType getMetadataLongType() throws ClassCastException { + return (MetadataLongType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataFloatType`. If the actual instance is not `MetadataFloatType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataFloatType` + * @throws ClassCastException if the instance is not `MetadataFloatType` + */ + public MetadataFloatType getMetadataFloatType() throws ClassCastException { + return (MetadataFloatType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataDateType`. If the actual instance is not `MetadataDateType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataDateType` + * @throws ClassCastException if the instance is not `MetadataDateType` + */ + public MetadataDateType getMetadataDateType() throws ClassCastException { + return (MetadataDateType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataStringType`. If the actual instance is not `MetadataStringType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataStringType` + * @throws ClassCastException if the instance is not `MetadataStringType` + */ + public MetadataStringType getMetadataStringType() throws ClassCastException { + return (MetadataStringType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataNullType`. If the actual instance is not `MetadataNullType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataNullType` + * @throws ClassCastException if the instance is not `MetadataNullType` + */ + public MetadataNullType getMetadataNullType() throws ClassCastException { + return (MetadataNullType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequestDataAttributesMetadataValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with MetadataLongType + try { + MetadataLongType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataFloatType + try { + MetadataFloatType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataDateType + try { + MetadataDateType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataStringType + try { + MetadataStringType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataNullType + try { + MetadataNullType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for UpdatePartRevisionRequestDataAttributesMetadataValue with anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of UpdatePartRevisionRequestDataAttributesMetadataValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePartRevisionRequestDataAttributesMetadataValue + * @throws IOException if the JSON string is invalid with respect to UpdatePartRevisionRequestDataAttributesMetadataValue + */ + public static UpdatePartRevisionRequestDataAttributesMetadataValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePartRevisionRequestDataAttributesMetadataValue.class); + } + + /** + * Convert an instance of UpdatePartRevisionRequestDataAttributesMetadataValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataRelationships.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataRelationships.java new file mode 100644 index 0000000..0401301 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataRelationships.java @@ -0,0 +1,240 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.FileRelationship; +import com.vertexvis.model.PartRenditionRelationship; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdatePartRevisionRequestDataRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdatePartRevisionRequestDataRelationships { + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private FileRelationship source; + + public static final String SERIALIZED_NAME_DEFAULT_PART_RENDITION = "defaultPartRendition"; + @SerializedName(SERIALIZED_NAME_DEFAULT_PART_RENDITION) + @javax.annotation.Nullable + private PartRenditionRelationship defaultPartRendition; + + public UpdatePartRevisionRequestDataRelationships() { + } + + public UpdatePartRevisionRequestDataRelationships source(@javax.annotation.Nullable FileRelationship source) { + this.source = source; + return this; + } + + /** + * Get source + * @return source + */ + @javax.annotation.Nullable + public FileRelationship getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable FileRelationship source) { + this.source = source; + } + + + public UpdatePartRevisionRequestDataRelationships defaultPartRendition(@javax.annotation.Nullable PartRenditionRelationship defaultPartRendition) { + this.defaultPartRendition = defaultPartRendition; + return this; + } + + /** + * Get defaultPartRendition + * @return defaultPartRendition + */ + @javax.annotation.Nullable + public PartRenditionRelationship getDefaultPartRendition() { + return defaultPartRendition; + } + + public void setDefaultPartRendition(@javax.annotation.Nullable PartRenditionRelationship defaultPartRendition) { + this.defaultPartRendition = defaultPartRendition; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdatePartRevisionRequestDataRelationships updatePartRevisionRequestDataRelationships = (UpdatePartRevisionRequestDataRelationships) o; + return Objects.equals(this.source, updatePartRevisionRequestDataRelationships.source) && + Objects.equals(this.defaultPartRendition, updatePartRevisionRequestDataRelationships.defaultPartRendition); + } + + @Override + public int hashCode() { + return Objects.hash(source, defaultPartRendition); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePartRevisionRequestDataRelationships {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" defaultPartRendition: ").append(toIndentedString(defaultPartRendition)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + openapiFields.add("defaultPartRendition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePartRevisionRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePartRevisionRequestDataRelationships is not found in the empty JSON string", UpdatePartRevisionRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePartRevisionRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePartRevisionRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + FileRelationship.validateJsonElement(jsonObj.get("source")); + } + // validate the optional field `defaultPartRendition` + if (jsonObj.get("defaultPartRendition") != null && !jsonObj.get("defaultPartRendition").isJsonNull()) { + PartRenditionRelationship.validateJsonElement(jsonObj.get("defaultPartRendition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePartRevisionRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePartRevisionRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePartRevisionRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePartRevisionRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePartRevisionRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePartRevisionRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePartRevisionRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to UpdatePartRevisionRequestDataRelationships + */ + public static UpdatePartRevisionRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePartRevisionRequestDataRelationships.class); + } + + /** + * Convert an instance of UpdatePartRevisionRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequest.java new file mode 100644 index 0000000..6fad57a --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequest.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpdateSceneAnnotationRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateSceneAnnotationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateSceneAnnotationRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private UpdateSceneAnnotationRequestData data; + + public UpdateSceneAnnotationRequest() { + } + + public UpdateSceneAnnotationRequest data(@javax.annotation.Nonnull UpdateSceneAnnotationRequestData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public UpdateSceneAnnotationRequestData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull UpdateSceneAnnotationRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSceneAnnotationRequest updateSceneAnnotationRequest = (UpdateSceneAnnotationRequest) o; + return Objects.equals(this.data, updateSceneAnnotationRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSceneAnnotationRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneAnnotationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneAnnotationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneAnnotationRequest is not found in the empty JSON string", UpdateSceneAnnotationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneAnnotationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneAnnotationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneAnnotationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneAnnotationRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneAnnotationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneAnnotationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneAnnotationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneAnnotationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneAnnotationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneAnnotationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneAnnotationRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneAnnotationRequest + */ + public static UpdateSceneAnnotationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneAnnotationRequest.class); + } + + /** + * Convert an instance of UpdateSceneAnnotationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestData.java new file mode 100644 index 0000000..4bc4f9d --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestData.java @@ -0,0 +1,245 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpdateSceneAnnotationRequestDataAttributes; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateSceneAnnotationRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateSceneAnnotationRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private UpdateSceneAnnotationRequestDataAttributes attributes; + + public UpdateSceneAnnotationRequestData() { + } + + public UpdateSceneAnnotationRequestData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public UpdateSceneAnnotationRequestData attributes(@javax.annotation.Nonnull UpdateSceneAnnotationRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public UpdateSceneAnnotationRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull UpdateSceneAnnotationRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSceneAnnotationRequestData updateSceneAnnotationRequestData = (UpdateSceneAnnotationRequestData) o; + return Objects.equals(this.type, updateSceneAnnotationRequestData.type) && + Objects.equals(this.attributes, updateSceneAnnotationRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSceneAnnotationRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneAnnotationRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneAnnotationRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneAnnotationRequestData is not found in the empty JSON string", UpdateSceneAnnotationRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneAnnotationRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneAnnotationRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneAnnotationRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateSceneAnnotationRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneAnnotationRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneAnnotationRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneAnnotationRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneAnnotationRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneAnnotationRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneAnnotationRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneAnnotationRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneAnnotationRequestData + */ + public static UpdateSceneAnnotationRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneAnnotationRequestData.class); + } + + /** + * Convert an instance of UpdateSceneAnnotationRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestDataAttributes.java new file mode 100644 index 0000000..dbbebc8 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateSceneAnnotationRequestDataAttributes.java @@ -0,0 +1,250 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreateSceneAnnotationRequestDataAttributesData; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpdateSceneAnnotationRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateSceneAnnotationRequestDataAttributes { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private CreateSceneAnnotationRequestDataAttributesData data; + + public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable + private String suppliedId; + + public UpdateSceneAnnotationRequestDataAttributes() { + } + + public UpdateSceneAnnotationRequestDataAttributes data(@javax.annotation.Nullable CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public CreateSceneAnnotationRequestDataAttributesData getData() { + return data; + } + + public void setData(@javax.annotation.Nullable CreateSceneAnnotationRequestDataAttributesData data) { + this.data = data; + } + + + public UpdateSceneAnnotationRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + return this; + } + + /** + * A customer provided ID used for correlation. + * @return suppliedId + */ + @javax.annotation.Nullable + public String getSuppliedId() { + return suppliedId; + } + + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { + this.suppliedId = suppliedId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSceneAnnotationRequestDataAttributes updateSceneAnnotationRequestDataAttributes = (UpdateSceneAnnotationRequestDataAttributes) o; + return Objects.equals(this.data, updateSceneAnnotationRequestDataAttributes.data) && + Objects.equals(this.suppliedId, updateSceneAnnotationRequestDataAttributes.suppliedId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(data, suppliedId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSceneAnnotationRequestDataAttributes {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" suppliedId: ").append(toIndentedString(suppliedId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("suppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneAnnotationRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneAnnotationRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneAnnotationRequestDataAttributes is not found in the empty JSON string", UpdateSceneAnnotationRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneAnnotationRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneAnnotationRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateSceneAnnotationRequestDataAttributesData.validateJsonElement(jsonObj.get("data")); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneAnnotationRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneAnnotationRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneAnnotationRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneAnnotationRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneAnnotationRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneAnnotationRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneAnnotationRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateSceneAnnotationRequestDataAttributes + */ + public static UpdateSceneAnnotationRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneAnnotationRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateSceneAnnotationRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequest.java index 1f8dca5..7544574 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneItemOverrideRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneItemOverrideRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemOverrideRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateSceneItemOverrideRequestData data; - public UpdateSceneItemOverrideRequest() { + public UpdateSceneItemOverrideRequest() { } - public UpdateSceneItemOverrideRequest data(UpdateSceneItemOverrideRequestData data) { - + public UpdateSceneItemOverrideRequest data(@javax.annotation.Nonnull UpdateSceneItemOverrideRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneItemOverrideRequestData getData() { return data; } - - public void setData(UpdateSceneItemOverrideRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateSceneItemOverrideRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemOverrideRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemOverrideRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemOverrideRequest is not found in the empty JSON string", UpdateSceneItemOverrideRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemOverrideRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemOverrideRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneItemOverrideRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneItemOverrideRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemOverrideRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemOverrideRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemOverrideRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemOverrideRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemOverrideRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemOverrideRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemOverrideRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemOverrideRequest + */ + public static UpdateSceneItemOverrideRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemOverrideRequest.class); + } + + /** + * Convert an instance of UpdateSceneItemOverrideRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestData.java index 7db7379..6fbfa15 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestData.java @@ -14,107 +14,120 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneItemOverrideRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateSceneItemOverrideRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemOverrideRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateSceneItemOverrideRequestDataAttributes attributes; - public UpdateSceneItemOverrideRequestData() { + public UpdateSceneItemOverrideRequestData() { } - public UpdateSceneItemOverrideRequestData type(String type) { - + public UpdateSceneItemOverrideRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item-override", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateSceneItemOverrideRequestData id(UUID id) { - + public UpdateSceneItemOverrideRequestData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public UpdateSceneItemOverrideRequestData attributes(UpdateSceneItemOverrideRequestDataAttributes attributes) { - + public UpdateSceneItemOverrideRequestData attributes(@javax.annotation.Nonnull UpdateSceneItemOverrideRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneItemOverrideRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateSceneItemOverrideRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateSceneItemOverrideRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemOverrideRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemOverrideRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemOverrideRequestData is not found in the empty JSON string", UpdateSceneItemOverrideRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemOverrideRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemOverrideRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneItemOverrideRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + UpdateSceneItemOverrideRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemOverrideRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemOverrideRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemOverrideRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemOverrideRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemOverrideRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemOverrideRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemOverrideRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemOverrideRequestData + */ + public static UpdateSceneItemOverrideRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemOverrideRequestData.class); + } + + /** + * Convert an instance of UpdateSceneItemOverrideRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestDataAttributes.java index a733d2f..3fe9c22 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemOverrideRequestDataAttributes.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,181 +21,186 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterialNullable; import com.vertexvis.model.Matrix4Nullable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import org.openapitools.jackson.nullable.JsonNullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateSceneItemOverrideRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemOverrideRequestDataAttributes { public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4Nullable transform; public static final String SERIALIZED_NAME_MATERIAL = "material"; @SerializedName(SERIALIZED_NAME_MATERIAL) + @javax.annotation.Nullable private ColorMaterialNullable material; public static final String SERIALIZED_NAME_SELECTED = "selected"; @SerializedName(SERIALIZED_NAME_SELECTED) + @javax.annotation.Nullable private Boolean selected; public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; - public UpdateSceneItemOverrideRequestDataAttributes() { + public UpdateSceneItemOverrideRequestDataAttributes() { } - public UpdateSceneItemOverrideRequestDataAttributes visible(Boolean visible) { - + public UpdateSceneItemOverrideRequestDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Item visibility. * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Item visibility.") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public UpdateSceneItemOverrideRequestDataAttributes transform(Matrix4Nullable transform) { - + public UpdateSceneItemOverrideRequestDataAttributes transform(@javax.annotation.Nullable Matrix4Nullable transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4Nullable getTransform() { return transform; } - - public void setTransform(Matrix4Nullable transform) { + public void setTransform(@javax.annotation.Nullable Matrix4Nullable transform) { this.transform = transform; } - public UpdateSceneItemOverrideRequestDataAttributes material(ColorMaterialNullable material) { - + public UpdateSceneItemOverrideRequestDataAttributes material(@javax.annotation.Nullable ColorMaterialNullable material) { this.material = material; return this; } - /** + /** * Get material * @return material - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public ColorMaterialNullable getMaterial() { return material; } - - public void setMaterial(ColorMaterialNullable material) { + public void setMaterial(@javax.annotation.Nullable ColorMaterialNullable material) { this.material = material; } - public UpdateSceneItemOverrideRequestDataAttributes selected(Boolean selected) { - + public UpdateSceneItemOverrideRequestDataAttributes selected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; return this; } - /** + /** * Get selected * @return selected - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getSelected() { return selected; } - - public void setSelected(Boolean selected) { + public void setSelected(@javax.annotation.Nullable Boolean selected) { this.selected = selected; } - public UpdateSceneItemOverrideRequestDataAttributes phantom(Boolean phantom) { - + public UpdateSceneItemOverrideRequestDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Get phantom * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public UpdateSceneItemOverrideRequestDataAttributes endItem(Boolean endItem) { - + public UpdateSceneItemOverrideRequestDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Get endItem * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -255,5 +259,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("visible"); + openapiFields.add("transform"); + openapiFields.add("material"); + openapiFields.add("selected"); + openapiFields.add("phantom"); + openapiFields.add("endItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemOverrideRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemOverrideRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemOverrideRequestDataAttributes is not found in the empty JSON string", UpdateSceneItemOverrideRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemOverrideRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemOverrideRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4Nullable.validateJsonElement(jsonObj.get("transform")); + } + // validate the optional field `material` + if (jsonObj.get("material") != null && !jsonObj.get("material").isJsonNull()) { + ColorMaterialNullable.validateJsonElement(jsonObj.get("material")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemOverrideRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemOverrideRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemOverrideRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemOverrideRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemOverrideRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemOverrideRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemOverrideRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemOverrideRequestDataAttributes + */ + public static UpdateSceneItemOverrideRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemOverrideRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateSceneItemOverrideRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequest.java index e97838c..5948fb4 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneItemRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneItemRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateSceneItemRequestData data; - public UpdateSceneItemRequest() { + public UpdateSceneItemRequest() { } - public UpdateSceneItemRequest data(UpdateSceneItemRequestData data) { - + public UpdateSceneItemRequest data(@javax.annotation.Nonnull UpdateSceneItemRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneItemRequestData getData() { return data; } - - public void setData(UpdateSceneItemRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateSceneItemRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemRequest is not found in the empty JSON string", UpdateSceneItemRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneItemRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneItemRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemRequest + */ + public static UpdateSceneItemRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemRequest.class); + } + + /** + * Convert an instance of UpdateSceneItemRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestData.java index 3af467d..a0bb74a 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,99 +21,113 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneItemRequestDataAttributes; import com.vertexvis.model.UpdateSceneItemRequestDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateSceneItemRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateSceneItemRequestDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private UpdateSceneItemRequestDataRelationships relationships; - public UpdateSceneItemRequestData() { + public UpdateSceneItemRequestData() { } - public UpdateSceneItemRequestData type(String type) { - + public UpdateSceneItemRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-item", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateSceneItemRequestData attributes(UpdateSceneItemRequestDataAttributes attributes) { - + public UpdateSceneItemRequestData attributes(@javax.annotation.Nonnull UpdateSceneItemRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneItemRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateSceneItemRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateSceneItemRequestDataAttributes attributes) { this.attributes = attributes; } - public UpdateSceneItemRequestData relationships(UpdateSceneItemRequestDataRelationships relationships) { - + public UpdateSceneItemRequestData relationships(@javax.annotation.Nullable UpdateSceneItemRequestDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public UpdateSceneItemRequestDataRelationships getRelationships() { return relationships; } - - public void setRelationships(UpdateSceneItemRequestDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable UpdateSceneItemRequestDataRelationships relationships) { this.relationships = relationships; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +169,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemRequestData is not found in the empty JSON string", UpdateSceneItemRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneItemRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateSceneItemRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + UpdateSceneItemRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemRequestData + */ + public static UpdateSceneItemRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemRequestData.class); + } + + /** + * Convert an instance of UpdateSceneItemRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java index 079e6a6..6e5f176 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java @@ -14,184 +14,191 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; import com.vertexvis.model.MaterialOverride; import com.vertexvis.model.Matrix4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneItemRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemRequestDataAttributes { public static final String SERIALIZED_NAME_VISIBLE = "visible"; @SerializedName(SERIALIZED_NAME_VISIBLE) + @javax.annotation.Nullable private Boolean visible; public static final String SERIALIZED_NAME_MATERIAL_OVERRIDE = "materialOverride"; @SerializedName(SERIALIZED_NAME_MATERIAL_OVERRIDE) + @javax.annotation.Nullable private MaterialOverride materialOverride; public static final String SERIALIZED_NAME_TRANSFORM = "transform"; @SerializedName(SERIALIZED_NAME_TRANSFORM) + @javax.annotation.Nullable private Matrix4 transform; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) + @javax.annotation.Nullable private Boolean phantom; public static final String SERIALIZED_NAME_END_ITEM = "endItem"; @SerializedName(SERIALIZED_NAME_END_ITEM) + @javax.annotation.Nullable private Boolean endItem; - public UpdateSceneItemRequestDataAttributes() { + public UpdateSceneItemRequestDataAttributes() { } - public UpdateSceneItemRequestDataAttributes visible(Boolean visible) { - + public UpdateSceneItemRequestDataAttributes visible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; return this; } - /** + /** * Item visibility. * @return visible - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Item visibility.") - public Boolean getVisible() { return visible; } - - public void setVisible(Boolean visible) { + public void setVisible(@javax.annotation.Nullable Boolean visible) { this.visible = visible; } - public UpdateSceneItemRequestDataAttributes materialOverride(MaterialOverride materialOverride) { - + public UpdateSceneItemRequestDataAttributes materialOverride(@javax.annotation.Nullable MaterialOverride materialOverride) { this.materialOverride = materialOverride; return this; } - /** + /** * Get materialOverride * @return materialOverride - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public MaterialOverride getMaterialOverride() { return materialOverride; } - - public void setMaterialOverride(MaterialOverride materialOverride) { + public void setMaterialOverride(@javax.annotation.Nullable MaterialOverride materialOverride) { this.materialOverride = materialOverride; } - public UpdateSceneItemRequestDataAttributes transform(Matrix4 transform) { - + public UpdateSceneItemRequestDataAttributes transform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; return this; } - /** + /** * Get transform * @return transform - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Matrix4 getTransform() { return transform; } - - public void setTransform(Matrix4 transform) { + public void setTransform(@javax.annotation.Nullable Matrix4 transform) { this.transform = transform; } - public UpdateSceneItemRequestDataAttributes name(String name) { - + public UpdateSceneItemRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public UpdateSceneItemRequestDataAttributes suppliedId(String suppliedId) { - + public UpdateSceneItemRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public UpdateSceneItemRequestDataAttributes metadata(Map metadata) { - + public UpdateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType metadataItem) { + public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -199,69 +206,59 @@ public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, AnyOfMet return this; } - /** + /** * Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. ") - - public Map getMetadata() { + public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } - public UpdateSceneItemRequestDataAttributes phantom(Boolean phantom) { - + public UpdateSceneItemRequestDataAttributes phantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; return this; } - /** + /** * Phantom state of the item. * @return phantom - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Phantom state of the item.") - public Boolean getPhantom() { return phantom; } - - public void setPhantom(Boolean phantom) { + public void setPhantom(@javax.annotation.Nullable Boolean phantom) { this.phantom = phantom; } - public UpdateSceneItemRequestDataAttributes endItem(Boolean endItem) { - + public UpdateSceneItemRequestDataAttributes endItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; return this; } - /** + /** * Whether this item is an end item. * @return endItem - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this item is an end item.") - public Boolean getEndItem() { return endItem; } - - public void setEndItem(Boolean endItem) { + public void setEndItem(@javax.annotation.Nullable Boolean endItem) { this.endItem = endItem; } + @Override public boolean equals(Object o) { if (this == o) { @@ -313,5 +310,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("visible"); + openapiFields.add("materialOverride"); + openapiFields.add("transform"); + openapiFields.add("name"); + openapiFields.add("suppliedId"); + openapiFields.add("metadata"); + openapiFields.add("phantom"); + openapiFields.add("endItem"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemRequestDataAttributes is not found in the empty JSON string", UpdateSceneItemRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `materialOverride` + if (jsonObj.get("materialOverride") != null && !jsonObj.get("materialOverride").isJsonNull()) { + MaterialOverride.validateJsonElement(jsonObj.get("materialOverride")); + } + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + Matrix4.validateJsonElement(jsonObj.get("transform")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemRequestDataAttributes + */ + public static UpdateSceneItemRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateSceneItemRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationships.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationships.java index 65dbfbd..76013dd 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationships.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationships.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdateSceneItemRequestDataRelationshipsSource; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; -import org.openapitools.jackson.nullable.JsonNullable; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneItemRequestDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneItemRequestDataRelationships { public static final String SERIALIZED_NAME_SOURCE = "source"; @SerializedName(SERIALIZED_NAME_SOURCE) - private AnyOfGeometrySetRelationshipPartRevisionRelationship source; + @javax.annotation.Nullable + private UpdateSceneItemRequestDataRelationshipsSource source; - public UpdateSceneItemRequestDataRelationships() { + public UpdateSceneItemRequestDataRelationships() { } - public UpdateSceneItemRequestDataRelationships source(AnyOfGeometrySetRelationshipPartRevisionRelationship source) { - + public UpdateSceneItemRequestDataRelationships source(@javax.annotation.Nullable UpdateSceneItemRequestDataRelationshipsSource source) { this.source = source; return this; } - /** - * Relationship to a `geometry-set` or `part-revision`. + /** + * Get source * @return source - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Relationship to a `geometry-set` or `part-revision`.") - - public AnyOfGeometrySetRelationshipPartRevisionRelationship getSource() { + public UpdateSceneItemRequestDataRelationshipsSource getSource() { return source; } - - public void setSource(AnyOfGeometrySetRelationshipPartRevisionRelationship source) { + public void setSource(@javax.annotation.Nullable UpdateSceneItemRequestDataRelationshipsSource source) { this.source = source; } + @Override public boolean equals(Object o) { if (this == o) { @@ -72,22 +91,11 @@ public boolean equals(Object o) { return Objects.equals(this.source, updateSceneItemRequestDataRelationships.source); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(source); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -108,5 +116,93 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneItemRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneItemRequestDataRelationships is not found in the empty JSON string", UpdateSceneItemRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneItemRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneItemRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + UpdateSceneItemRequestDataRelationshipsSource.validateJsonElement(jsonObj.get("source")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneItemRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneItemRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneItemRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemRequestDataRelationships + */ + public static UpdateSceneItemRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemRequestDataRelationships.class); + } + + /** + * Convert an instance of UpdateSceneItemRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java new file mode 100644 index 0000000..6621a1b --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java @@ -0,0 +1,268 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.GeometrySetRelationship; +import com.vertexvis.model.PartDataRelationshipsPartRevisions; +import com.vertexvis.model.PartRevisionRelationship; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateSceneItemRequestDataRelationshipsSource extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateSceneItemRequestDataRelationshipsSource.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneItemRequestDataRelationshipsSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneItemRequestDataRelationshipsSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterGeometrySetRelationship = gson.getDelegateAdapter(this, TypeToken.get(GeometrySetRelationship.class)); + final TypeAdapter adapterPartRevisionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneItemRequestDataRelationshipsSource value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `GeometrySetRelationship` + if (value.getActualInstance() instanceof GeometrySetRelationship) { + JsonElement element = adapterGeometrySetRelationship.toJsonTree((GeometrySetRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionRelationship` + if (value.getActualInstance() instanceof PartRevisionRelationship) { + JsonElement element = adapterPartRevisionRelationship.toJsonTree((PartRevisionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: GeometrySetRelationship, PartRevisionRelationship"); + } + + @Override + public UpdateSceneItemRequestDataRelationshipsSource read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize GeometrySetRelationship + try { + // validate the JSON object to see if any exception is thrown + GeometrySetRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterGeometrySetRelationship; + UpdateSceneItemRequestDataRelationshipsSource ret = new UpdateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'GeometrySetRelationship'", e); + } + // deserialize PartRevisionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRevisionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionRelationship; + UpdateSceneItemRequestDataRelationshipsSource ret = new UpdateSceneItemRequestDataRelationshipsSource(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionRelationship'", e); + } + + throw new IOException(String.format("Failed deserialization for UpdateSceneItemRequestDataRelationshipsSource: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public UpdateSceneItemRequestDataRelationshipsSource() { + super("anyOf", Boolean.FALSE); + } + + public UpdateSceneItemRequestDataRelationshipsSource(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GeometrySetRelationship", GeometrySetRelationship.class); + schemas.put("PartRevisionRelationship", PartRevisionRelationship.class); + } + + @Override + public Map> getSchemas() { + return UpdateSceneItemRequestDataRelationshipsSource.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * GeometrySetRelationship, PartRevisionRelationship + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof GeometrySetRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be GeometrySetRelationship, PartRevisionRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * GeometrySetRelationship, PartRevisionRelationship + * + * @return The actual instance (GeometrySetRelationship, PartRevisionRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GeometrySetRelationship`. If the actual instance is not `GeometrySetRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GeometrySetRelationship` + * @throws ClassCastException if the instance is not `GeometrySetRelationship` + */ + public GeometrySetRelationship getGeometrySetRelationship() throws ClassCastException { + return (GeometrySetRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionRelationship`. If the actual instance is not `PartRevisionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionRelationship` + * @throws ClassCastException if the instance is not `PartRevisionRelationship` + */ + public PartRevisionRelationship getPartRevisionRelationship() throws ClassCastException { + return (PartRevisionRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneItemRequestDataRelationshipsSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with GeometrySetRelationship + try { + GeometrySetRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for GeometrySetRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionRelationship + try { + PartRevisionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for UpdateSceneItemRequestDataRelationshipsSource with anyOf schemas: GeometrySetRelationship, PartRevisionRelationship. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of UpdateSceneItemRequestDataRelationshipsSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneItemRequestDataRelationshipsSource + * @throws IOException if the JSON string is invalid with respect to UpdateSceneItemRequestDataRelationshipsSource + */ + public static UpdateSceneItemRequestDataRelationshipsSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneItemRequestDataRelationshipsSource.class); + } + + /** + * Convert an instance of UpdateSceneItemRequestDataRelationshipsSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneRequest.java index 77a1c39..a65aad0 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateSceneRequestData data; - public UpdateSceneRequest() { + public UpdateSceneRequest() { } - public UpdateSceneRequest data(UpdateSceneRequestData data) { - + public UpdateSceneRequest data(@javax.annotation.Nonnull UpdateSceneRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneRequestData getData() { return data; } - - public void setData(UpdateSceneRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateSceneRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneRequest is not found in the empty JSON string", UpdateSceneRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneRequest + */ + public static UpdateSceneRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneRequest.class); + } + + /** + * Convert an instance of UpdateSceneRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneRequestData.java index 45c28da..6b008ec 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateSceneRequestDataAttributes attributes; - public UpdateSceneRequestData() { + public UpdateSceneRequestData() { } - public UpdateSceneRequestData type(String type) { - + public UpdateSceneRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateSceneRequestData attributes(UpdateSceneRequestDataAttributes attributes) { - + public UpdateSceneRequestData attributes(@javax.annotation.Nonnull UpdateSceneRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateSceneRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateSceneRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneRequestData is not found in the empty JSON string", UpdateSceneRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateSceneRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneRequestData + */ + public static UpdateSceneRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneRequestData.class); + } + + /** + * Convert an instance of UpdateSceneRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java index b5bb903..af2a2a8 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java @@ -14,26 +14,51 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Orientation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdateSceneViewRequestDataAttributesCamera; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import org.openapitools.jackson.nullable.JsonNullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateSceneRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneRequestDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private AnyOfPerspectiveCameraOrthographicCameraCameraFit camera; + @javax.annotation.Nullable + private UpdateSceneViewRequestDataAttributesCamera camera; /** * State of the scene. @@ -80,169 +105,188 @@ public StateEnum read(final JsonReader jsonReader) throws IOException { return StateEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StateEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_STATE = "state"; @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable private StateEnum state; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TREE_ENABLED = "treeEnabled"; @SerializedName(SERIALIZED_NAME_TREE_ENABLED) + @javax.annotation.Nullable private Boolean treeEnabled; public static final String SERIALIZED_NAME_WORLD_ORIENTATION = "worldOrientation"; @SerializedName(SERIALIZED_NAME_WORLD_ORIENTATION) + @javax.annotation.Nullable private Orientation worldOrientation; - public UpdateSceneRequestDataAttributes() { + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); + + public UpdateSceneRequestDataAttributes() { } - public UpdateSceneRequestDataAttributes camera(AnyOfPerspectiveCameraOrthographicCameraCameraFit camera) { - + public UpdateSceneRequestDataAttributes camera(@javax.annotation.Nullable UpdateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public AnyOfPerspectiveCameraOrthographicCameraCameraFit getCamera() { + public UpdateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(AnyOfPerspectiveCameraOrthographicCameraCameraFit camera) { + public void setCamera(@javax.annotation.Nullable UpdateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public UpdateSceneRequestDataAttributes state(StateEnum state) { - + public UpdateSceneRequestDataAttributes state(@javax.annotation.Nullable StateEnum state) { this.state = state; return this; } - /** + /** * State of the scene. * @return state - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "commit", value = "State of the scene.") - public StateEnum getState() { return state; } - - public void setState(StateEnum state) { + public void setState(@javax.annotation.Nullable StateEnum state) { this.state = state; } - public UpdateSceneRequestDataAttributes suppliedId(String suppliedId) { - + public UpdateSceneRequestDataAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * ID provided for correlation. For example, an existing ID from a PLM system. * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "PN12345", value = "ID provided for correlation. For example, an existing ID from a PLM system.") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public UpdateSceneRequestDataAttributes name(String name) { - + public UpdateSceneRequestDataAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public UpdateSceneRequestDataAttributes treeEnabled(Boolean treeEnabled) { - + public UpdateSceneRequestDataAttributes treeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; return this; } - /** + /** * Whether or not scene trees can be viewed for this scene. * @return treeEnabled - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether or not scene trees can be viewed for this scene.") - public Boolean getTreeEnabled() { return treeEnabled; } - - public void setTreeEnabled(Boolean treeEnabled) { + public void setTreeEnabled(@javax.annotation.Nullable Boolean treeEnabled) { this.treeEnabled = treeEnabled; } - public UpdateSceneRequestDataAttributes worldOrientation(Orientation worldOrientation) { - + public UpdateSceneRequestDataAttributes worldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; return this; } - /** + /** * Get worldOrientation * @return worldOrientation - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Orientation getWorldOrientation() { return worldOrientation; } - - public void setWorldOrientation(Orientation worldOrientation) { + public void setWorldOrientation(@javax.annotation.Nullable Orientation worldOrientation) { this.worldOrientation = worldOrientation; } + public UpdateSceneRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public UpdateSceneRequestDataAttributes putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. A null value will delete the entry in the map, all other key/value pairs provided here will be inserted or updated into the existing scene metadata. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + } + + + @Override public boolean equals(Object o) { if (this == o) { @@ -257,7 +301,8 @@ public boolean equals(Object o) { Objects.equals(this.suppliedId, updateSceneRequestDataAttributes.suppliedId) && Objects.equals(this.name, updateSceneRequestDataAttributes.name) && Objects.equals(this.treeEnabled, updateSceneRequestDataAttributes.treeEnabled) && - Objects.equals(this.worldOrientation, updateSceneRequestDataAttributes.worldOrientation); + Objects.equals(this.worldOrientation, updateSceneRequestDataAttributes.worldOrientation) && + Objects.equals(this.metadata, updateSceneRequestDataAttributes.metadata); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -266,7 +311,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(camera, state, suppliedId, name, treeEnabled, worldOrientation); + return Objects.hash(camera, state, suppliedId, name, treeEnabled, worldOrientation, metadata); } private static int hashCodeNullable(JsonNullable a) { @@ -286,6 +331,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" treeEnabled: ").append(toIndentedString(treeEnabled)).append("\n"); sb.append(" worldOrientation: ").append(toIndentedString(worldOrientation)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append("}"); return sb.toString(); } @@ -301,5 +347,116 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("state"); + openapiFields.add("suppliedId"); + openapiFields.add("name"); + openapiFields.add("treeEnabled"); + openapiFields.add("worldOrientation"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneRequestDataAttributes is not found in the empty JSON string", UpdateSceneRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + UpdateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + // validate the optional field `state` + if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) { + StateEnum.validateJsonElement(jsonObj.get("state")); + } + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `worldOrientation` + if (jsonObj.get("worldOrientation") != null && !jsonObj.get("worldOrientation").isJsonNull()) { + Orientation.validateJsonElement(jsonObj.get("worldOrientation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateSceneRequestDataAttributes + */ + public static UpdateSceneRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateSceneRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneViewRequest.java index f2b5d0a..cbcb0b2 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneViewRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneViewRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneViewRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneViewRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateSceneViewRequestData data; - public UpdateSceneViewRequest() { + public UpdateSceneViewRequest() { } - public UpdateSceneViewRequest data(UpdateSceneViewRequestData data) { - + public UpdateSceneViewRequest data(@javax.annotation.Nonnull UpdateSceneViewRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneViewRequestData getData() { return data; } - - public void setData(UpdateSceneViewRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateSceneViewRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneViewRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneViewRequest is not found in the empty JSON string", UpdateSceneViewRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneViewRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneViewRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneViewRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneViewRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneViewRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneViewRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneViewRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewRequest + */ + public static UpdateSceneViewRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewRequest.class); + } + + /** + * Convert an instance of UpdateSceneViewRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestData.java index 1e767c9..e31b7c7 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneViewRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneViewRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneViewRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneViewRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateSceneViewRequestDataAttributes attributes; - public UpdateSceneViewRequestData() { + public UpdateSceneViewRequestData() { } - public UpdateSceneViewRequestData type(String type) { - + public UpdateSceneViewRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateSceneViewRequestData attributes(UpdateSceneViewRequestDataAttributes attributes) { - + public UpdateSceneViewRequestData attributes(@javax.annotation.Nonnull UpdateSceneViewRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneViewRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateSceneViewRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateSceneViewRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneViewRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneViewRequestData is not found in the empty JSON string", UpdateSceneViewRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneViewRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneViewRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneViewRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateSceneViewRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneViewRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneViewRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneViewRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewRequestData + */ + public static UpdateSceneViewRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewRequestData.class); + } + + /** + * Convert an instance of UpdateSceneViewRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributes.java index 9a3169d..310e804 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributes.java @@ -14,107 +14,121 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CrossSectioning; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.UpdateSceneViewRequestDataAttributesCamera; import java.io.IOException; +import java.util.Arrays; import org.openapitools.jackson.nullable.JsonNullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateSceneViewRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneViewRequestDataAttributes { public static final String SERIALIZED_NAME_CAMERA = "camera"; @SerializedName(SERIALIZED_NAME_CAMERA) - private AnyOfPerspectiveCameraOrthographicCameraCameraFit camera; + @javax.annotation.Nullable + private UpdateSceneViewRequestDataAttributesCamera camera; public static final String SERIALIZED_NAME_CROSS_SECTIONING = "crossSectioning"; @SerializedName(SERIALIZED_NAME_CROSS_SECTIONING) + @javax.annotation.Nullable private CrossSectioning crossSectioning; public static final String SERIALIZED_NAME_NO_DEFAULT_LIGHTS = "noDefaultLights"; @SerializedName(SERIALIZED_NAME_NO_DEFAULT_LIGHTS) + @javax.annotation.Nullable private Boolean noDefaultLights; - public UpdateSceneViewRequestDataAttributes() { + public UpdateSceneViewRequestDataAttributes() { } - public UpdateSceneViewRequestDataAttributes camera(AnyOfPerspectiveCameraOrthographicCameraCameraFit camera) { - + public UpdateSceneViewRequestDataAttributes camera(@javax.annotation.Nullable UpdateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; return this; } - /** + /** * Get camera * @return camera - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public AnyOfPerspectiveCameraOrthographicCameraCameraFit getCamera() { + public UpdateSceneViewRequestDataAttributesCamera getCamera() { return camera; } - - public void setCamera(AnyOfPerspectiveCameraOrthographicCameraCameraFit camera) { + public void setCamera(@javax.annotation.Nullable UpdateSceneViewRequestDataAttributesCamera camera) { this.camera = camera; } - public UpdateSceneViewRequestDataAttributes crossSectioning(CrossSectioning crossSectioning) { - + public UpdateSceneViewRequestDataAttributes crossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; return this; } - /** + /** * Get crossSectioning * @return crossSectioning - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public CrossSectioning getCrossSectioning() { return crossSectioning; } - - public void setCrossSectioning(CrossSectioning crossSectioning) { + public void setCrossSectioning(@javax.annotation.Nullable CrossSectioning crossSectioning) { this.crossSectioning = crossSectioning; } - public UpdateSceneViewRequestDataAttributes noDefaultLights(Boolean noDefaultLights) { - + public UpdateSceneViewRequestDataAttributes noDefaultLights(@javax.annotation.Nullable Boolean noDefaultLights) { this.noDefaultLights = noDefaultLights; return this; } - /** + /** * Whether or not to turn off default lighting * @return noDefaultLights - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "Whether or not to turn off default lighting") - public Boolean getNoDefaultLights() { return noDefaultLights; } - - public void setNoDefaultLights(Boolean noDefaultLights) { + public void setNoDefaultLights(@javax.annotation.Nullable Boolean noDefaultLights) { this.noDefaultLights = noDefaultLights; } + @Override public boolean equals(Object o) { if (this == o) { @@ -167,5 +181,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("camera"); + openapiFields.add("crossSectioning"); + openapiFields.add("noDefaultLights"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneViewRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneViewRequestDataAttributes is not found in the empty JSON string", UpdateSceneViewRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneViewRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneViewRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `camera` + if (jsonObj.get("camera") != null && !jsonObj.get("camera").isJsonNull()) { + UpdateSceneViewRequestDataAttributesCamera.validateJsonElement(jsonObj.get("camera")); + } + // validate the optional field `crossSectioning` + if (jsonObj.get("crossSectioning") != null && !jsonObj.get("crossSectioning").isJsonNull()) { + CrossSectioning.validateJsonElement(jsonObj.get("crossSectioning")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneViewRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneViewRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneViewRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewRequestDataAttributes + */ + public static UpdateSceneViewRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateSceneViewRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributesCamera.java b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributesCamera.java new file mode 100644 index 0000000..f89e223 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewRequestDataAttributesCamera.java @@ -0,0 +1,315 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CameraFit; +import com.vertexvis.model.OrthographicCamera; +import com.vertexvis.model.PerspectiveCamera; +import com.vertexvis.model.Vector3; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpdateSceneViewRequestDataAttributesCamera extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateSceneViewRequestDataAttributesCamera.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewRequestDataAttributesCamera.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewRequestDataAttributesCamera' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPerspectiveCamera = gson.getDelegateAdapter(this, TypeToken.get(PerspectiveCamera.class)); + final TypeAdapter adapterOrthographicCamera = gson.getDelegateAdapter(this, TypeToken.get(OrthographicCamera.class)); + final TypeAdapter adapterCameraFit = gson.getDelegateAdapter(this, TypeToken.get(CameraFit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewRequestDataAttributesCamera value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PerspectiveCamera` + if (value.getActualInstance() instanceof PerspectiveCamera) { + JsonElement element = adapterPerspectiveCamera.toJsonTree((PerspectiveCamera)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `OrthographicCamera` + if (value.getActualInstance() instanceof OrthographicCamera) { + JsonElement element = adapterOrthographicCamera.toJsonTree((OrthographicCamera)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CameraFit` + if (value.getActualInstance() instanceof CameraFit) { + JsonElement element = adapterCameraFit.toJsonTree((CameraFit)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: CameraFit, OrthographicCamera, PerspectiveCamera"); + } + + @Override + public UpdateSceneViewRequestDataAttributesCamera read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PerspectiveCamera + try { + // validate the JSON object to see if any exception is thrown + PerspectiveCamera.validateJsonElement(jsonElement); + actualAdapter = adapterPerspectiveCamera; + UpdateSceneViewRequestDataAttributesCamera ret = new UpdateSceneViewRequestDataAttributesCamera(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PerspectiveCamera failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PerspectiveCamera'", e); + } + // deserialize OrthographicCamera + try { + // validate the JSON object to see if any exception is thrown + OrthographicCamera.validateJsonElement(jsonElement); + actualAdapter = adapterOrthographicCamera; + UpdateSceneViewRequestDataAttributesCamera ret = new UpdateSceneViewRequestDataAttributesCamera(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OrthographicCamera failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'OrthographicCamera'", e); + } + // deserialize CameraFit + try { + // validate the JSON object to see if any exception is thrown + CameraFit.validateJsonElement(jsonElement); + actualAdapter = adapterCameraFit; + UpdateSceneViewRequestDataAttributesCamera ret = new UpdateSceneViewRequestDataAttributesCamera(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CameraFit failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CameraFit'", e); + } + + throw new IOException(String.format("Failed deserialization for UpdateSceneViewRequestDataAttributesCamera: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public UpdateSceneViewRequestDataAttributesCamera() { + super("anyOf", Boolean.FALSE); + } + + public UpdateSceneViewRequestDataAttributesCamera(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PerspectiveCamera", PerspectiveCamera.class); + schemas.put("OrthographicCamera", OrthographicCamera.class); + schemas.put("CameraFit", CameraFit.class); + } + + @Override + public Map> getSchemas() { + return UpdateSceneViewRequestDataAttributesCamera.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * CameraFit, OrthographicCamera, PerspectiveCamera + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PerspectiveCamera) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof OrthographicCamera) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CameraFit) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CameraFit, OrthographicCamera, PerspectiveCamera"); + } + + /** + * Get the actual instance, which can be the following: + * CameraFit, OrthographicCamera, PerspectiveCamera + * + * @return The actual instance (CameraFit, OrthographicCamera, PerspectiveCamera) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PerspectiveCamera`. If the actual instance is not `PerspectiveCamera`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PerspectiveCamera` + * @throws ClassCastException if the instance is not `PerspectiveCamera` + */ + public PerspectiveCamera getPerspectiveCamera() throws ClassCastException { + return (PerspectiveCamera)super.getActualInstance(); + } + + /** + * Get the actual instance of `OrthographicCamera`. If the actual instance is not `OrthographicCamera`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OrthographicCamera` + * @throws ClassCastException if the instance is not `OrthographicCamera` + */ + public OrthographicCamera getOrthographicCamera() throws ClassCastException { + return (OrthographicCamera)super.getActualInstance(); + } + + /** + * Get the actual instance of `CameraFit`. If the actual instance is not `CameraFit`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CameraFit` + * @throws ClassCastException if the instance is not `CameraFit` + */ + public CameraFit getCameraFit() throws ClassCastException { + return (CameraFit)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewRequestDataAttributesCamera + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PerspectiveCamera + try { + PerspectiveCamera.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PerspectiveCamera failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with OrthographicCamera + try { + OrthographicCamera.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for OrthographicCamera failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CameraFit + try { + CameraFit.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CameraFit failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for UpdateSceneViewRequestDataAttributesCamera with anyOf schemas: CameraFit, OrthographicCamera, PerspectiveCamera. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of UpdateSceneViewRequestDataAttributesCamera given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewRequestDataAttributesCamera + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewRequestDataAttributesCamera + */ + public static UpdateSceneViewRequestDataAttributesCamera fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewRequestDataAttributesCamera.class); + } + + /** + * Convert an instance of UpdateSceneViewRequestDataAttributesCamera to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequest.java b/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequest.java index f46717f..ae54a7c 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateSceneViewStateRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneViewStateRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneViewStateRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateSceneViewStateRequestData data; - public UpdateSceneViewStateRequest() { + public UpdateSceneViewStateRequest() { } - public UpdateSceneViewStateRequest data(UpdateSceneViewStateRequestData data) { - + public UpdateSceneViewStateRequest data(@javax.annotation.Nonnull UpdateSceneViewStateRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateSceneViewStateRequestData getData() { return data; } - - public void setData(UpdateSceneViewStateRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateSceneViewStateRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewStateRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneViewStateRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneViewStateRequest is not found in the empty JSON string", UpdateSceneViewStateRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneViewStateRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneViewStateRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneViewStateRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateSceneViewStateRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewStateRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewStateRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneViewStateRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewStateRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneViewStateRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneViewStateRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewStateRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewStateRequest + */ + public static UpdateSceneViewStateRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewStateRequest.class); + } + + /** + * Convert an instance of UpdateSceneViewStateRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequestData.java b/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequestData.java index 4e21554..44637b4 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneViewStateRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.CreateSceneViewStateRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateSceneViewStateRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateSceneViewStateRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private CreateSceneViewStateRequestDataAttributes attributes; - public UpdateSceneViewStateRequestData() { + public UpdateSceneViewStateRequestData() { } - public UpdateSceneViewStateRequestData type(String type) { - + public UpdateSceneViewStateRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene-view-state", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateSceneViewStateRequestData attributes(CreateSceneViewStateRequestDataAttributes attributes) { - + public UpdateSceneViewStateRequestData attributes(@javax.annotation.Nonnull CreateSceneViewStateRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public CreateSceneViewStateRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(CreateSceneViewStateRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull CreateSceneViewStateRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSceneViewStateRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSceneViewStateRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSceneViewStateRequestData is not found in the empty JSON string", UpdateSceneViewStateRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSceneViewStateRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSceneViewStateRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSceneViewStateRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSceneViewStateRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSceneViewStateRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSceneViewStateRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSceneViewStateRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSceneViewStateRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSceneViewStateRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSceneViewStateRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSceneViewStateRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateSceneViewStateRequestData + */ + public static UpdateSceneViewStateRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSceneViewStateRequestData.class); + } + + /** + * Convert an instance of UpdateSceneViewStateRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequest.java b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequest.java index d585f1d..5b0ca2c 100644 --- a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequest.java +++ b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequest.java @@ -14,52 +14,71 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateWebhookSubscriptionRequestData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateWebhookSubscriptionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateWebhookSubscriptionRequest { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private UpdateWebhookSubscriptionRequestData data; - public UpdateWebhookSubscriptionRequest() { + public UpdateWebhookSubscriptionRequest() { } - public UpdateWebhookSubscriptionRequest data(UpdateWebhookSubscriptionRequestData data) { - + public UpdateWebhookSubscriptionRequest data(@javax.annotation.Nonnull UpdateWebhookSubscriptionRequestData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateWebhookSubscriptionRequestData getData() { return data; } - - public void setData(UpdateWebhookSubscriptionRequestData data) { + public void setData(@javax.annotation.Nonnull UpdateWebhookSubscriptionRequestData data) { this.data = data; } + @Override public boolean equals(Object o) { if (this == o) { @@ -97,5 +116,99 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWebhookSubscriptionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWebhookSubscriptionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWebhookSubscriptionRequest is not found in the empty JSON string", UpdateWebhookSubscriptionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWebhookSubscriptionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWebhookSubscriptionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateWebhookSubscriptionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateWebhookSubscriptionRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWebhookSubscriptionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWebhookSubscriptionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateWebhookSubscriptionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWebhookSubscriptionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWebhookSubscriptionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWebhookSubscriptionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWebhookSubscriptionRequest + * @throws IOException if the JSON string is invalid with respect to UpdateWebhookSubscriptionRequest + */ + public static UpdateWebhookSubscriptionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWebhookSubscriptionRequest.class); + } + + /** + * Convert an instance of UpdateWebhookSubscriptionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestData.java b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestData.java index 71b6fb3..87ecbf6 100644 --- a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestData.java +++ b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.UpdateWebhookSubscriptionRequestDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * UpdateWebhookSubscriptionRequestData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateWebhookSubscriptionRequestData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private UpdateWebhookSubscriptionRequestDataAttributes attributes; - public UpdateWebhookSubscriptionRequestData() { + public UpdateWebhookSubscriptionRequestData() { } - public UpdateWebhookSubscriptionRequestData type(String type) { - + public UpdateWebhookSubscriptionRequestData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "webhook-subscription", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public UpdateWebhookSubscriptionRequestData attributes(UpdateWebhookSubscriptionRequestDataAttributes attributes) { - + public UpdateWebhookSubscriptionRequestData attributes(@javax.annotation.Nonnull UpdateWebhookSubscriptionRequestDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public UpdateWebhookSubscriptionRequestDataAttributes getAttributes() { return attributes; } - - public void setAttributes(UpdateWebhookSubscriptionRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull UpdateWebhookSubscriptionRequestDataAttributes attributes) { this.attributes = attributes; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWebhookSubscriptionRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWebhookSubscriptionRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWebhookSubscriptionRequestData is not found in the empty JSON string", UpdateWebhookSubscriptionRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWebhookSubscriptionRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWebhookSubscriptionRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateWebhookSubscriptionRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateWebhookSubscriptionRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWebhookSubscriptionRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWebhookSubscriptionRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateWebhookSubscriptionRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWebhookSubscriptionRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWebhookSubscriptionRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWebhookSubscriptionRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWebhookSubscriptionRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateWebhookSubscriptionRequestData + */ + public static UpdateWebhookSubscriptionRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWebhookSubscriptionRequestData.class); + } + + /** + * Convert an instance of UpdateWebhookSubscriptionRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestDataAttributes.java index 3244fdd..1aef45b 100644 --- a/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateWebhookSubscriptionRequestDataAttributes.java @@ -14,22 +14,43 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * UpdateWebhookSubscriptionRequestDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class UpdateWebhookSubscriptionRequestDataAttributes { /** * Status of subscription. @@ -76,48 +97,51 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { return StatusEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private StatusEnum status; public static final String SERIALIZED_NAME_TOPICS = "topics"; @SerializedName(SERIALIZED_NAME_TOPICS) - private List topics = null; + @javax.annotation.Nullable + private List topics = new ArrayList<>(); public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable private String url; - public UpdateWebhookSubscriptionRequestDataAttributes() { + public UpdateWebhookSubscriptionRequestDataAttributes() { } - public UpdateWebhookSubscriptionRequestDataAttributes status(StatusEnum status) { - + public UpdateWebhookSubscriptionRequestDataAttributes status(@javax.annotation.Nullable StatusEnum status) { this.status = status; return this; } - /** + /** * Status of subscription. * @return status - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "active", value = "Status of subscription.") - public StatusEnum getStatus() { return status; } - - public void setStatus(StatusEnum status) { + public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } - public UpdateWebhookSubscriptionRequestDataAttributes topics(List topics) { - + public UpdateWebhookSubscriptionRequestDataAttributes topics(@javax.annotation.Nullable List topics) { this.topics = topics; return this; } @@ -130,46 +154,40 @@ public UpdateWebhookSubscriptionRequestDataAttributes addTopicsItem(String topic return this; } - /** + /** * Get topics * @return topics - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getTopics() { return topics; } - - public void setTopics(List topics) { + public void setTopics(@javax.annotation.Nullable List topics) { this.topics = topics; } - public UpdateWebhookSubscriptionRequestDataAttributes url(String url) { - + public UpdateWebhookSubscriptionRequestDataAttributes url(@javax.annotation.Nullable String url) { this.url = url; return this; } - /** + /** * Get url * @return url - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getUrl() { return url; } - - public void setUrl(String url) { + public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } + @Override public boolean equals(Object o) { if (this == o) { @@ -211,5 +229,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("topics"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWebhookSubscriptionRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWebhookSubscriptionRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWebhookSubscriptionRequestDataAttributes is not found in the empty JSON string", UpdateWebhookSubscriptionRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWebhookSubscriptionRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWebhookSubscriptionRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("topics") != null && !jsonObj.get("topics").isJsonNull() && !jsonObj.get("topics").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `topics` to be an array in the JSON string but got `%s`", jsonObj.get("topics").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWebhookSubscriptionRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWebhookSubscriptionRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateWebhookSubscriptionRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWebhookSubscriptionRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWebhookSubscriptionRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWebhookSubscriptionRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWebhookSubscriptionRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateWebhookSubscriptionRequestDataAttributes + */ + public static UpdateWebhookSubscriptionRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWebhookSubscriptionRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateWebhookSubscriptionRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequest.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequest.java new file mode 100644 index 0000000..845f79e --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequest.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpsertPropertyEntriesRequestData; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpsertPropertyEntriesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private UpsertPropertyEntriesRequestData data; + + public UpsertPropertyEntriesRequest() { + } + + public UpsertPropertyEntriesRequest data(@javax.annotation.Nonnull UpsertPropertyEntriesRequestData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public UpsertPropertyEntriesRequestData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull UpsertPropertyEntriesRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertPropertyEntriesRequest upsertPropertyEntriesRequest = (UpsertPropertyEntriesRequest) o; + return Objects.equals(this.data, upsertPropertyEntriesRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertPropertyEntriesRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertPropertyEntriesRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertPropertyEntriesRequest is not found in the empty JSON string", UpsertPropertyEntriesRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertPropertyEntriesRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertPropertyEntriesRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertPropertyEntriesRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpsertPropertyEntriesRequestData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertPropertyEntriesRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertPropertyEntriesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpsertPropertyEntriesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequest + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequest + */ + public static UpsertPropertyEntriesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequest.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestData.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestData.java new file mode 100644 index 0000000..6753e26 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestData.java @@ -0,0 +1,276 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpsertPropertyEntriesRequestDataAttributes; +import com.vertexvis.model.UpsertPropertyEntriesRequestDataRelationships; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpsertPropertyEntriesRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull + private UpsertPropertyEntriesRequestDataAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nonnull + private UpsertPropertyEntriesRequestDataRelationships relationships; + + public UpsertPropertyEntriesRequestData() { + } + + public UpsertPropertyEntriesRequestData type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Resource object type. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public UpsertPropertyEntriesRequestData attributes(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nonnull + public UpsertPropertyEntriesRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + public UpsertPropertyEntriesRequestData relationships(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataRelationships relationships) { + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + */ + @javax.annotation.Nonnull + public UpsertPropertyEntriesRequestDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertPropertyEntriesRequestData upsertPropertyEntriesRequestData = (UpsertPropertyEntriesRequestData) o; + return Objects.equals(this.type, upsertPropertyEntriesRequestData.type) && + Objects.equals(this.attributes, upsertPropertyEntriesRequestData.attributes) && + Objects.equals(this.relationships, upsertPropertyEntriesRequestData.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertPropertyEntriesRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertPropertyEntriesRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertPropertyEntriesRequestData is not found in the empty JSON string", UpsertPropertyEntriesRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertPropertyEntriesRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertPropertyEntriesRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertPropertyEntriesRequestData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpsertPropertyEntriesRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + UpsertPropertyEntriesRequestDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertPropertyEntriesRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertPropertyEntriesRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpsertPropertyEntriesRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequestData + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequestData + */ + public static UpsertPropertyEntriesRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequestData.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributes.java new file mode 100644 index 0000000..8904c00 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributes.java @@ -0,0 +1,222 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpsertPropertyEntriesRequestDataAttributesEntriesValue; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpsertPropertyEntriesRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequestDataAttributes { + public static final String SERIALIZED_NAME_ENTRIES = "entries"; + @SerializedName(SERIALIZED_NAME_ENTRIES) + @javax.annotation.Nonnull + private Map entries = new HashMap<>(); + + public UpsertPropertyEntriesRequestDataAttributes() { + } + + public UpsertPropertyEntriesRequestDataAttributes entries(@javax.annotation.Nonnull Map entries) { + this.entries = entries; + return this; + } + + public UpsertPropertyEntriesRequestDataAttributes putEntriesItem(String key, UpsertPropertyEntriesRequestDataAttributesEntriesValue entriesItem) { + if (this.entries == null) { + this.entries = new HashMap<>(); + } + this.entries.put(key, entriesItem); + return this; + } + + /** + * Property entries for a provided resource or property set. + * @return entries + */ + @javax.annotation.Nonnull + public Map getEntries() { + return entries; + } + + public void setEntries(@javax.annotation.Nonnull Map entries) { + this.entries = entries; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertPropertyEntriesRequestDataAttributes upsertPropertyEntriesRequestDataAttributes = (UpsertPropertyEntriesRequestDataAttributes) o; + return Objects.equals(this.entries, upsertPropertyEntriesRequestDataAttributes.entries); + } + + @Override + public int hashCode() { + return Objects.hash(entries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertPropertyEntriesRequestDataAttributes {\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("entries"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("entries"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertPropertyEntriesRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertPropertyEntriesRequestDataAttributes is not found in the empty JSON string", UpsertPropertyEntriesRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertPropertyEntriesRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertPropertyEntriesRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertPropertyEntriesRequestDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertPropertyEntriesRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertPropertyEntriesRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpsertPropertyEntriesRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequestDataAttributes + */ + public static UpsertPropertyEntriesRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequestDataAttributes.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributesEntriesValue.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributesEntriesValue.java new file mode 100644 index 0000000..ef7d5c7 --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataAttributesEntriesValue.java @@ -0,0 +1,414 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PropertyDateType; +import com.vertexvis.model.PropertyDoubleType; +import com.vertexvis.model.PropertyLongType; +import com.vertexvis.model.PropertyStringType; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequestDataAttributesEntriesValue extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpsertPropertyEntriesRequestDataAttributesEntriesValue.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequestDataAttributesEntriesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequestDataAttributesEntriesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPropertyStringType = gson.getDelegateAdapter(this, TypeToken.get(PropertyStringType.class)); + final TypeAdapter adapterPropertyDoubleType = gson.getDelegateAdapter(this, TypeToken.get(PropertyDoubleType.class)); + final TypeAdapter adapterPropertyLongType = gson.getDelegateAdapter(this, TypeToken.get(PropertyLongType.class)); + final TypeAdapter adapterPropertyDateType = gson.getDelegateAdapter(this, TypeToken.get(PropertyDateType.class)); + final TypeAdapter adapterObject = gson.getDelegateAdapter(this, TypeToken.get(Object.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequestDataAttributesEntriesValue value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PropertyStringType` + if (value.getActualInstance() instanceof PropertyStringType) { + JsonElement element = adapterPropertyStringType.toJsonTree((PropertyStringType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyDoubleType` + if (value.getActualInstance() instanceof PropertyDoubleType) { + JsonElement element = adapterPropertyDoubleType.toJsonTree((PropertyDoubleType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyLongType` + if (value.getActualInstance() instanceof PropertyLongType) { + JsonElement element = adapterPropertyLongType.toJsonTree((PropertyLongType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PropertyDateType` + if (value.getActualInstance() instanceof PropertyDateType) { + JsonElement element = adapterPropertyDateType.toJsonTree((PropertyDateType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Object` + if (value.getActualInstance() instanceof Object) { + JsonPrimitive primitive = adapterObject.toJsonTree((Object)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType"); + } + + @Override + public UpsertPropertyEntriesRequestDataAttributesEntriesValue read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PropertyStringType + try { + // validate the JSON object to see if any exception is thrown + PropertyStringType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyStringType; + UpsertPropertyEntriesRequestDataAttributesEntriesValue ret = new UpsertPropertyEntriesRequestDataAttributesEntriesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyStringType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyStringType'", e); + } + // deserialize PropertyDoubleType + try { + // validate the JSON object to see if any exception is thrown + PropertyDoubleType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyDoubleType; + UpsertPropertyEntriesRequestDataAttributesEntriesValue ret = new UpsertPropertyEntriesRequestDataAttributesEntriesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyDoubleType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyDoubleType'", e); + } + // deserialize PropertyLongType + try { + // validate the JSON object to see if any exception is thrown + PropertyLongType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyLongType; + UpsertPropertyEntriesRequestDataAttributesEntriesValue ret = new UpsertPropertyEntriesRequestDataAttributesEntriesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyLongType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyLongType'", e); + } + // deserialize PropertyDateType + try { + // validate the JSON object to see if any exception is thrown + PropertyDateType.validateJsonElement(jsonElement); + actualAdapter = adapterPropertyDateType; + UpsertPropertyEntriesRequestDataAttributesEntriesValue ret = new UpsertPropertyEntriesRequestDataAttributesEntriesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertyDateType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertyDateType'", e); + } + // deserialize Object + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterObject; + UpsertPropertyEntriesRequestDataAttributesEntriesValue ret = new UpsertPropertyEntriesRequestDataAttributesEntriesValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Object failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Object'", e); + } + + throw new IOException(String.format("Failed deserialization for UpsertPropertyEntriesRequestDataAttributesEntriesValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public UpsertPropertyEntriesRequestDataAttributesEntriesValue() { + super("anyOf", Boolean.TRUE); + } + + public UpsertPropertyEntriesRequestDataAttributesEntriesValue(Object o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("PropertyStringType", PropertyStringType.class); + schemas.put("PropertyDoubleType", PropertyDoubleType.class); + schemas.put("PropertyLongType", PropertyLongType.class); + schemas.put("PropertyDateType", PropertyDateType.class); + schemas.put("Object", Object.class); + } + + @Override + public Map> getSchemas() { + return UpsertPropertyEntriesRequestDataAttributesEntriesValue.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyStringType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyDoubleType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyLongType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PropertyDateType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Object) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType"); + } + + /** + * Get the actual instance, which can be the following: + * Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType + * + * @return The actual instance (Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyStringType`. If the actual instance is not `PropertyStringType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyStringType` + * @throws ClassCastException if the instance is not `PropertyStringType` + */ + public PropertyStringType getPropertyStringType() throws ClassCastException { + return (PropertyStringType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyDoubleType`. If the actual instance is not `PropertyDoubleType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyDoubleType` + * @throws ClassCastException if the instance is not `PropertyDoubleType` + */ + public PropertyDoubleType getPropertyDoubleType() throws ClassCastException { + return (PropertyDoubleType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyLongType`. If the actual instance is not `PropertyLongType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyLongType` + * @throws ClassCastException if the instance is not `PropertyLongType` + */ + public PropertyLongType getPropertyLongType() throws ClassCastException { + return (PropertyLongType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertyDateType`. If the actual instance is not `PropertyDateType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertyDateType` + * @throws ClassCastException if the instance is not `PropertyDateType` + */ + public PropertyDateType getPropertyDateType() throws ClassCastException { + return (PropertyDateType)super.getActualInstance(); + } + + /** + * Get the actual instance of `Object`. If the actual instance is not `Object`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Object` + * @throws ClassCastException if the instance is not `Object` + */ + public Object getObject() throws ClassCastException { + return (Object)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequestDataAttributesEntriesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PropertyStringType + try { + PropertyStringType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyStringType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyDoubleType + try { + PropertyDoubleType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyDoubleType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyLongType + try { + PropertyLongType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyLongType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PropertyDateType + try { + PropertyDateType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertyDateType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with Object + try { + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString())); + } + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for Object failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for UpsertPropertyEntriesRequestDataAttributesEntriesValue with anyOf schemas: Object, PropertyDateType, PropertyDoubleType, PropertyLongType, PropertyStringType. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of UpsertPropertyEntriesRequestDataAttributesEntriesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequestDataAttributesEntriesValue + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequestDataAttributesEntriesValue + */ + public static UpsertPropertyEntriesRequestDataAttributesEntriesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequestDataAttributesEntriesValue.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequestDataAttributesEntriesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationships.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationships.java new file mode 100644 index 0000000..d4b21ce --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationships.java @@ -0,0 +1,214 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.UpsertPropertyEntriesRequestDataRelationshipsPropertySet; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + +/** + * UpsertPropertyEntriesRequestDataRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequestDataRelationships { + public static final String SERIALIZED_NAME_PROPERTY_SET = "propertySet"; + @SerializedName(SERIALIZED_NAME_PROPERTY_SET) + @javax.annotation.Nonnull + private UpsertPropertyEntriesRequestDataRelationshipsPropertySet propertySet; + + public UpsertPropertyEntriesRequestDataRelationships() { + } + + public UpsertPropertyEntriesRequestDataRelationships propertySet(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataRelationshipsPropertySet propertySet) { + this.propertySet = propertySet; + return this; + } + + /** + * Get propertySet + * @return propertySet + */ + @javax.annotation.Nonnull + public UpsertPropertyEntriesRequestDataRelationshipsPropertySet getPropertySet() { + return propertySet; + } + + public void setPropertySet(@javax.annotation.Nonnull UpsertPropertyEntriesRequestDataRelationshipsPropertySet propertySet) { + this.propertySet = propertySet; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertPropertyEntriesRequestDataRelationships upsertPropertyEntriesRequestDataRelationships = (UpsertPropertyEntriesRequestDataRelationships) o; + return Objects.equals(this.propertySet, upsertPropertyEntriesRequestDataRelationships.propertySet); + } + + @Override + public int hashCode() { + return Objects.hash(propertySet); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertPropertyEntriesRequestDataRelationships {\n"); + sb.append(" propertySet: ").append(toIndentedString(propertySet)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("propertySet"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("propertySet"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequestDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertPropertyEntriesRequestDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertPropertyEntriesRequestDataRelationships is not found in the empty JSON string", UpsertPropertyEntriesRequestDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertPropertyEntriesRequestDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertPropertyEntriesRequestDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertPropertyEntriesRequestDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `propertySet` + UpsertPropertyEntriesRequestDataRelationshipsPropertySet.validateJsonElement(jsonObj.get("propertySet")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequestDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequestDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertPropertyEntriesRequestDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequestDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertPropertyEntriesRequestDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpsertPropertyEntriesRequestDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequestDataRelationships + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequestDataRelationships + */ + public static UpsertPropertyEntriesRequestDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequestDataRelationships.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequestDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationshipsPropertySet.java b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationshipsPropertySet.java new file mode 100644 index 0000000..271f27f --- /dev/null +++ b/src/main/java/com/vertexvis/model/UpsertPropertyEntriesRequestDataRelationshipsPropertySet.java @@ -0,0 +1,360 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.PartInstanceRelationship; +import com.vertexvis.model.PartInstanceRelationshipData; +import com.vertexvis.model.PartRevisionRelationship; +import com.vertexvis.model.PropertySetRelationship; +import com.vertexvis.model.SceneItemRelationship; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class UpsertPropertyEntriesRequestDataRelationshipsPropertySet extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpsertPropertyEntriesRequestDataRelationshipsPropertySet.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertPropertyEntriesRequestDataRelationshipsPropertySet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertPropertyEntriesRequestDataRelationshipsPropertySet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPropertySetRelationship = gson.getDelegateAdapter(this, TypeToken.get(PropertySetRelationship.class)); + final TypeAdapter adapterPartRevisionRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartRevisionRelationship.class)); + final TypeAdapter adapterSceneItemRelationship = gson.getDelegateAdapter(this, TypeToken.get(SceneItemRelationship.class)); + final TypeAdapter adapterPartInstanceRelationship = gson.getDelegateAdapter(this, TypeToken.get(PartInstanceRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertPropertyEntriesRequestDataRelationshipsPropertySet value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PropertySetRelationship` + if (value.getActualInstance() instanceof PropertySetRelationship) { + JsonElement element = adapterPropertySetRelationship.toJsonTree((PropertySetRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartRevisionRelationship` + if (value.getActualInstance() instanceof PartRevisionRelationship) { + JsonElement element = adapterPartRevisionRelationship.toJsonTree((PartRevisionRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneItemRelationship` + if (value.getActualInstance() instanceof SceneItemRelationship) { + JsonElement element = adapterSceneItemRelationship.toJsonTree((SceneItemRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PartInstanceRelationship` + if (value.getActualInstance() instanceof PartInstanceRelationship) { + JsonElement element = adapterPartInstanceRelationship.toJsonTree((PartInstanceRelationship)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship"); + } + + @Override + public UpsertPropertyEntriesRequestDataRelationshipsPropertySet read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PropertySetRelationship + try { + // validate the JSON object to see if any exception is thrown + PropertySetRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPropertySetRelationship; + UpsertPropertyEntriesRequestDataRelationshipsPropertySet ret = new UpsertPropertyEntriesRequestDataRelationshipsPropertySet(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PropertySetRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PropertySetRelationship'", e); + } + // deserialize PartRevisionRelationship + try { + // validate the JSON object to see if any exception is thrown + PartRevisionRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartRevisionRelationship; + UpsertPropertyEntriesRequestDataRelationshipsPropertySet ret = new UpsertPropertyEntriesRequestDataRelationshipsPropertySet(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartRevisionRelationship'", e); + } + // deserialize SceneItemRelationship + try { + // validate the JSON object to see if any exception is thrown + SceneItemRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterSceneItemRelationship; + UpsertPropertyEntriesRequestDataRelationshipsPropertySet ret = new UpsertPropertyEntriesRequestDataRelationshipsPropertySet(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneItemRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneItemRelationship'", e); + } + // deserialize PartInstanceRelationship + try { + // validate the JSON object to see if any exception is thrown + PartInstanceRelationship.validateJsonElement(jsonElement); + actualAdapter = adapterPartInstanceRelationship; + UpsertPropertyEntriesRequestDataRelationshipsPropertySet ret = new UpsertPropertyEntriesRequestDataRelationshipsPropertySet(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PartInstanceRelationship failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PartInstanceRelationship'", e); + } + + throw new IOException(String.format("Failed deserialization for UpsertPropertyEntriesRequestDataRelationshipsPropertySet: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public UpsertPropertyEntriesRequestDataRelationshipsPropertySet() { + super("anyOf", Boolean.FALSE); + } + + public UpsertPropertyEntriesRequestDataRelationshipsPropertySet(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PropertySetRelationship", PropertySetRelationship.class); + schemas.put("PartRevisionRelationship", PartRevisionRelationship.class); + schemas.put("SceneItemRelationship", SceneItemRelationship.class); + schemas.put("PartInstanceRelationship", PartInstanceRelationship.class); + } + + @Override + public Map> getSchemas() { + return UpsertPropertyEntriesRequestDataRelationshipsPropertySet.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PropertySetRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartRevisionRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneItemRelationship) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PartInstanceRelationship) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship"); + } + + /** + * Get the actual instance, which can be the following: + * PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship + * + * @return The actual instance (PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PropertySetRelationship`. If the actual instance is not `PropertySetRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PropertySetRelationship` + * @throws ClassCastException if the instance is not `PropertySetRelationship` + */ + public PropertySetRelationship getPropertySetRelationship() throws ClassCastException { + return (PropertySetRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartRevisionRelationship`. If the actual instance is not `PartRevisionRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartRevisionRelationship` + * @throws ClassCastException if the instance is not `PartRevisionRelationship` + */ + public PartRevisionRelationship getPartRevisionRelationship() throws ClassCastException { + return (PartRevisionRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneItemRelationship`. If the actual instance is not `SceneItemRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneItemRelationship` + * @throws ClassCastException if the instance is not `SceneItemRelationship` + */ + public SceneItemRelationship getSceneItemRelationship() throws ClassCastException { + return (SceneItemRelationship)super.getActualInstance(); + } + + /** + * Get the actual instance of `PartInstanceRelationship`. If the actual instance is not `PartInstanceRelationship`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PartInstanceRelationship` + * @throws ClassCastException if the instance is not `PartInstanceRelationship` + */ + public PartInstanceRelationship getPartInstanceRelationship() throws ClassCastException { + return (PartInstanceRelationship)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertPropertyEntriesRequestDataRelationshipsPropertySet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PropertySetRelationship + try { + PropertySetRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PropertySetRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartRevisionRelationship + try { + PartRevisionRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartRevisionRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneItemRelationship + try { + SceneItemRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneItemRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PartInstanceRelationship + try { + PartInstanceRelationship.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PartInstanceRelationship failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for UpsertPropertyEntriesRequestDataRelationshipsPropertySet with anyOf schemas: PartInstanceRelationship, PartRevisionRelationship, PropertySetRelationship, SceneItemRelationship. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of UpsertPropertyEntriesRequestDataRelationshipsPropertySet given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertPropertyEntriesRequestDataRelationshipsPropertySet + * @throws IOException if the JSON string is invalid with respect to UpsertPropertyEntriesRequestDataRelationshipsPropertySet + */ + public static UpsertPropertyEntriesRequestDataRelationshipsPropertySet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertPropertyEntriesRequestDataRelationshipsPropertySet.class); + } + + /** + * Convert an instance of UpsertPropertyEntriesRequestDataRelationshipsPropertySet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/Vector3.java b/src/main/java/com/vertexvis/model/Vector3.java index 88626e9..d008fc8 100644 --- a/src/main/java/com/vertexvis/model/Vector3.java +++ b/src/main/java/com/vertexvis/model/Vector3.java @@ -14,107 +14,119 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * 3D vector. */ -@ApiModel(description = "3D vector.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Vector3 { public static final String SERIALIZED_NAME_X = "x"; @SerializedName(SERIALIZED_NAME_X) + @javax.annotation.Nonnull private BigDecimal x; public static final String SERIALIZED_NAME_Y = "y"; @SerializedName(SERIALIZED_NAME_Y) + @javax.annotation.Nonnull private BigDecimal y; public static final String SERIALIZED_NAME_Z = "z"; @SerializedName(SERIALIZED_NAME_Z) + @javax.annotation.Nonnull private BigDecimal z; - public Vector3() { + public Vector3() { } - public Vector3 x(BigDecimal x) { - + public Vector3 x(@javax.annotation.Nonnull BigDecimal x) { this.x = x; return this; } - /** + /** * x-axis coordinate. * @return x - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "1.0", required = true, value = "x-axis coordinate.") - public BigDecimal getX() { return x; } - - public void setX(BigDecimal x) { + public void setX(@javax.annotation.Nonnull BigDecimal x) { this.x = x; } - public Vector3 y(BigDecimal y) { - + public Vector3 y(@javax.annotation.Nonnull BigDecimal y) { this.y = y; return this; } - /** + /** * y-axis coordinate. * @return y - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "y-axis coordinate.") - public BigDecimal getY() { return y; } - - public void setY(BigDecimal y) { + public void setY(@javax.annotation.Nonnull BigDecimal y) { this.y = y; } - public Vector3 z(BigDecimal z) { - + public Vector3 z(@javax.annotation.Nonnull BigDecimal z) { this.z = z; return this; } - /** + /** * z-axis coordinate. * @return z - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "z-axis coordinate.") - public BigDecimal getZ() { return z; } - - public void setZ(BigDecimal z) { + public void setZ(@javax.annotation.Nonnull BigDecimal z) { this.z = z; } + @Override public boolean equals(Object o) { if (this == o) { @@ -156,5 +168,101 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x"); + openapiFields.add("y"); + openapiFields.add("z"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x"); + openapiRequiredFields.add("y"); + openapiRequiredFields.add("z"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Vector3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Vector3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Vector3 is not found in the empty JSON string", Vector3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Vector3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Vector3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Vector3.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Vector3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Vector3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Vector3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Vector3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Vector3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Vector3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Vector3 + * @throws IOException if the JSON string is invalid with respect to Vector3 + */ + public static Vector3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Vector3.class); + } + + /** + * Convert an instance of Vector3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/Vector4.java b/src/main/java/com/vertexvis/model/Vector4.java index 9114f89..8d76381 100644 --- a/src/main/java/com/vertexvis/model/Vector4.java +++ b/src/main/java/com/vertexvis/model/Vector4.java @@ -14,134 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * 4D vector. */ -@ApiModel(description = "4D vector.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Vector4 { public static final String SERIALIZED_NAME_X = "x"; @SerializedName(SERIALIZED_NAME_X) + @javax.annotation.Nonnull private BigDecimal x; public static final String SERIALIZED_NAME_Y = "y"; @SerializedName(SERIALIZED_NAME_Y) + @javax.annotation.Nonnull private BigDecimal y; public static final String SERIALIZED_NAME_Z = "z"; @SerializedName(SERIALIZED_NAME_Z) + @javax.annotation.Nonnull private BigDecimal z; public static final String SERIALIZED_NAME_W = "w"; @SerializedName(SERIALIZED_NAME_W) + @javax.annotation.Nonnull private BigDecimal w; - public Vector4() { + public Vector4() { } - public Vector4 x(BigDecimal x) { - + public Vector4 x(@javax.annotation.Nonnull BigDecimal x) { this.x = x; return this; } - /** + /** * x-axis coordinate. * @return x - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "1.0", required = true, value = "x-axis coordinate.") - public BigDecimal getX() { return x; } - - public void setX(BigDecimal x) { + public void setX(@javax.annotation.Nonnull BigDecimal x) { this.x = x; } - public Vector4 y(BigDecimal y) { - + public Vector4 y(@javax.annotation.Nonnull BigDecimal y) { this.y = y; return this; } - /** + /** * y-axis coordinate. * @return y - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "y-axis coordinate.") - public BigDecimal getY() { return y; } - - public void setY(BigDecimal y) { + public void setY(@javax.annotation.Nonnull BigDecimal y) { this.y = y; } - public Vector4 z(BigDecimal z) { - + public Vector4 z(@javax.annotation.Nonnull BigDecimal z) { this.z = z; return this; } - /** + /** * z-axis coordinate. * @return z - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "z-axis coordinate.") - public BigDecimal getZ() { return z; } - - public void setZ(BigDecimal z) { + public void setZ(@javax.annotation.Nonnull BigDecimal z) { this.z = z; } - public Vector4 w(BigDecimal w) { - + public Vector4 w(@javax.annotation.Nonnull BigDecimal w) { this.w = w; return this; } - /** + /** * w value. * @return w - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "0.0", required = true, value = "w value.") - public BigDecimal getW() { return w; } - - public void setW(BigDecimal w) { + public void setW(@javax.annotation.Nonnull BigDecimal w) { this.w = w; } + @Override public boolean equals(Object o) { if (this == o) { @@ -185,5 +194,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("x"); + openapiFields.add("y"); + openapiFields.add("z"); + openapiFields.add("w"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("x"); + openapiRequiredFields.add("y"); + openapiRequiredFields.add("z"); + openapiRequiredFields.add("w"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Vector4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Vector4.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Vector4 is not found in the empty JSON string", Vector4.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Vector4.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Vector4` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Vector4.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Vector4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Vector4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Vector4.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Vector4 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Vector4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Vector4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Vector4 + * @throws IOException if the JSON string is invalid with respect to Vector4 + */ + public static Vector4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Vector4.class); + } + + /** + * Convert an instance of Vector4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ViewDefaultRenOp.java b/src/main/java/com/vertexvis/model/ViewDefaultRenOp.java index 6674b35..fcf0894 100644 --- a/src/main/java/com/vertexvis/model/ViewDefaultRenOp.java +++ b/src/main/java/com/vertexvis/model/ViewDefaultRenOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ViewDefaultRenOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ViewDefaultRenOp { /** * Resource object type. @@ -72,38 +93,41 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; - public ViewDefaultRenOp() { + public ViewDefaultRenOp() { } - public ViewDefaultRenOp type(TypeEnum type) { - + public ViewDefaultRenOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "view-default-rendition", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +165,102 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ViewDefaultRenOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ViewDefaultRenOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ViewDefaultRenOp is not found in the empty JSON string", ViewDefaultRenOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ViewDefaultRenOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ViewDefaultRenOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ViewDefaultRenOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ViewDefaultRenOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ViewDefaultRenOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ViewDefaultRenOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ViewDefaultRenOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ViewDefaultRenOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ViewDefaultRenOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ViewDefaultRenOp + * @throws IOException if the JSON string is invalid with respect to ViewDefaultRenOp + */ + public static ViewDefaultRenOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ViewDefaultRenOp.class); + } + + /** + * Convert an instance of ViewDefaultRenOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ViewRenByIdOp.java b/src/main/java/com/vertexvis/model/ViewRenByIdOp.java index f03bb57..9a1323c 100644 --- a/src/main/java/com/vertexvis/model/ViewRenByIdOp.java +++ b/src/main/java/com/vertexvis/model/ViewRenByIdOp.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ViewRenByIdOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ViewRenByIdOp { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_RENDITION_ID = "renditionId"; @SerializedName(SERIALIZED_NAME_RENDITION_ID) + @javax.annotation.Nonnull private UUID renditionId; - public ViewRenByIdOp() { + public ViewRenByIdOp() { } - public ViewRenByIdOp type(TypeEnum type) { - + public ViewRenByIdOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "view-rendition-by-id", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ViewRenByIdOp renditionId(UUID renditionId) { - + public ViewRenByIdOp renditionId(@javax.annotation.Nonnull UUID renditionId) { this.renditionId = renditionId; return this; } - /** + /** * ID of the resource. * @return renditionId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getRenditionId() { return renditionId; } - - public void setRenditionId(UUID renditionId) { + public void setRenditionId(@javax.annotation.Nonnull UUID renditionId) { this.renditionId = renditionId; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("renditionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("renditionId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ViewRenByIdOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ViewRenByIdOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ViewRenByIdOp is not found in the empty JSON string", ViewRenByIdOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ViewRenByIdOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ViewRenByIdOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ViewRenByIdOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("renditionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `renditionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("renditionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ViewRenByIdOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ViewRenByIdOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ViewRenByIdOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ViewRenByIdOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ViewRenByIdOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ViewRenByIdOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ViewRenByIdOp + * @throws IOException if the JSON string is invalid with respect to ViewRenByIdOp + */ + public static ViewRenByIdOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ViewRenByIdOp.class); + } + + /** + * Convert an instance of ViewRenByIdOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ViewRenBySuppliedIdOp.java b/src/main/java/com/vertexvis/model/ViewRenBySuppliedIdOp.java index a302419..ddba079 100644 --- a/src/main/java/com/vertexvis/model/ViewRenBySuppliedIdOp.java +++ b/src/main/java/com/vertexvis/model/ViewRenBySuppliedIdOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ViewRenBySuppliedIdOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ViewRenBySuppliedIdOp { /** * Resource object type. @@ -72,65 +93,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_RENDITION_SUPPLIED_ID = "renditionSuppliedId"; @SerializedName(SERIALIZED_NAME_RENDITION_SUPPLIED_ID) + @javax.annotation.Nonnull private String renditionSuppliedId; - public ViewRenBySuppliedIdOp() { + public ViewRenBySuppliedIdOp() { } - public ViewRenBySuppliedIdOp type(TypeEnum type) { - + public ViewRenBySuppliedIdOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "view-rendition-by-supplied-id", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ViewRenBySuppliedIdOp renditionSuppliedId(String renditionSuppliedId) { - + public ViewRenBySuppliedIdOp renditionSuppliedId(@javax.annotation.Nonnull String renditionSuppliedId) { this.renditionSuppliedId = renditionSuppliedId; return this; } - /** + /** * Get renditionSuppliedId * @return renditionSuppliedId - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public String getRenditionSuppliedId() { return renditionSuppliedId; } - - public void setRenditionSuppliedId(String renditionSuppliedId) { + public void setRenditionSuppliedId(@javax.annotation.Nonnull String renditionSuppliedId) { this.renditionSuppliedId = renditionSuppliedId; } + @Override public boolean equals(Object o) { if (this == o) { @@ -170,5 +191,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("renditionSuppliedId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("renditionSuppliedId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ViewRenBySuppliedIdOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ViewRenBySuppliedIdOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ViewRenBySuppliedIdOp is not found in the empty JSON string", ViewRenBySuppliedIdOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ViewRenBySuppliedIdOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ViewRenBySuppliedIdOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ViewRenBySuppliedIdOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("renditionSuppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `renditionSuppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("renditionSuppliedId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ViewRenBySuppliedIdOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ViewRenBySuppliedIdOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ViewRenBySuppliedIdOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ViewRenBySuppliedIdOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ViewRenBySuppliedIdOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ViewRenBySuppliedIdOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ViewRenBySuppliedIdOp + * @throws IOException if the JSON string is invalid with respect to ViewRenBySuppliedIdOp + */ + public static ViewRenBySuppliedIdOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ViewRenBySuppliedIdOp.class); + } + + /** + * Convert an instance of ViewRenBySuppliedIdOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ViewRepByIdOp.java b/src/main/java/com/vertexvis/model/ViewRepByIdOp.java index 28adcb7..e8bee70 100644 --- a/src/main/java/com/vertexvis/model/ViewRepByIdOp.java +++ b/src/main/java/com/vertexvis/model/ViewRepByIdOp.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ViewRepByIdOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ViewRepByIdOp { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public ViewRepByIdOp() { + public ViewRepByIdOp() { } - public ViewRepByIdOp type(TypeEnum type) { - + public ViewRepByIdOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "view-representation-by-id", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ViewRepByIdOp id(UUID id) { - + public ViewRepByIdOp id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ViewRepByIdOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ViewRepByIdOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ViewRepByIdOp is not found in the empty JSON string", ViewRepByIdOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ViewRepByIdOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ViewRepByIdOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ViewRepByIdOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ViewRepByIdOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ViewRepByIdOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ViewRepByIdOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ViewRepByIdOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ViewRepByIdOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ViewRepByIdOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ViewRepByIdOp + * @throws IOException if the JSON string is invalid with respect to ViewRepByIdOp + */ + public static ViewRepByIdOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ViewRepByIdOp.class); + } + + /** + * Convert an instance of ViewRepByIdOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/ViewRepByPredefinedIdOp.java b/src/main/java/com/vertexvis/model/ViewRepByPredefinedIdOp.java index f3aa250..815bf9c 100644 --- a/src/main/java/com/vertexvis/model/ViewRepByPredefinedIdOp.java +++ b/src/main/java/com/vertexvis/model/ViewRepByPredefinedIdOp.java @@ -14,20 +14,41 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * ViewRepByPredefinedIdOp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class ViewRepByPredefinedIdOp { /** * Resource object type. @@ -72,10 +93,16 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; /** @@ -123,61 +150,60 @@ public IdEnum read(final JsonReader jsonReader) throws IOException { return IdEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IdEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private IdEnum id; - public ViewRepByPredefinedIdOp() { + public ViewRepByPredefinedIdOp() { } - public ViewRepByPredefinedIdOp type(TypeEnum type) { - + public ViewRepByPredefinedIdOp type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "view-representation-by-predefined-id", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public ViewRepByPredefinedIdOp id(IdEnum id) { - + public ViewRepByPredefinedIdOp id(@javax.annotation.Nonnull IdEnum id) { this.id = id; return this; } - /** + /** * A predefined representation identifier, such as `entire-part`. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "entire-part", required = true, value = "A predefined representation identifier, such as `entire-part`.") - public IdEnum getId() { return id; } - - public void setId(IdEnum id) { + public void setId(@javax.annotation.Nonnull IdEnum id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -217,5 +243,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ViewRepByPredefinedIdOp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ViewRepByPredefinedIdOp.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ViewRepByPredefinedIdOp is not found in the empty JSON string", ViewRepByPredefinedIdOp.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ViewRepByPredefinedIdOp.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ViewRepByPredefinedIdOp` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ViewRepByPredefinedIdOp.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `id` + IdEnum.validateJsonElement(jsonObj.get("id")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ViewRepByPredefinedIdOp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ViewRepByPredefinedIdOp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ViewRepByPredefinedIdOp.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ViewRepByPredefinedIdOp value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ViewRepByPredefinedIdOp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ViewRepByPredefinedIdOp given an JSON string + * + * @param jsonString JSON string + * @return An instance of ViewRepByPredefinedIdOp + * @throws IOException if the JSON string is invalid with respect to ViewRepByPredefinedIdOp + */ + public static ViewRepByPredefinedIdOp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ViewRepByPredefinedIdOp.class); + } + + /** + * Convert an instance of ViewRepByPredefinedIdOp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEvent.java b/src/main/java/com/vertexvis/model/WebhookEvent.java index 3dc9920..8247732 100644 --- a/src/main/java/com/vertexvis/model/WebhookEvent.java +++ b/src/main/java/com/vertexvis/model/WebhookEvent.java @@ -14,98 +14,114 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; -import com.vertexvis.model.OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData; import com.vertexvis.model.WebhookEventData; -import com.vertexvis.model.WebhookEventPartRevisionIncludedData; -import com.vertexvis.model.WebhookEventSceneIncludedData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.vertexvis.model.WebhookEventIncludedInner; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookEvent */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEvent { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private WebhookEventData data; public static final String SERIALIZED_NAME_INCLUDED = "included"; @SerializedName(SERIALIZED_NAME_INCLUDED) - private List included = new ArrayList<>(); + @javax.annotation.Nonnull + private List included = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public WebhookEvent() { + public WebhookEvent() { } - public WebhookEvent data(WebhookEventData data) { - + public WebhookEvent data(@javax.annotation.Nonnull WebhookEventData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventData getData() { return data; } - - public void setData(WebhookEventData data) { + public void setData(@javax.annotation.Nonnull WebhookEventData data) { this.data = data; } - public WebhookEvent included(List included) { - + public WebhookEvent included(@javax.annotation.Nonnull List included) { this.included = included; return this; } - public WebhookEvent addIncludedItem(OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData includedItem) { + public WebhookEvent addIncludedItem(WebhookEventIncludedInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } this.included.add(includedItem); return this; } - /** + /** * Get included * @return included - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public List getIncluded() { + public List getIncluded() { return included; } - - public void setIncluded(List included) { + public void setIncluded(@javax.annotation.Nonnull List included) { this.included = included; } - public WebhookEvent links(Map links) { - + public WebhookEvent links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -118,23 +134,21 @@ public WebhookEvent putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -176,5 +190,112 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("included"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEvent is not found in the empty JSON string", WebhookEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + WebhookEventData.validateJsonElement(jsonObj.get("data")); + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + // validate the required field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + WebhookEventIncludedInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEvent + * @throws IOException if the JSON string is invalid with respect to WebhookEvent + */ + public static WebhookEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEvent.class); + } + + /** + * Convert an instance of WebhookEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventData.java b/src/main/java/com/vertexvis/model/WebhookEventData.java index 0dd7e14..20f061a 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventData.java +++ b/src/main/java/com/vertexvis/model/WebhookEventData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,136 +22,145 @@ import com.vertexvis.model.Link; import com.vertexvis.model.WebhookEventDataAttributes; import com.vertexvis.model.WebhookEventDataRelationships; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookEventData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private WebhookEventDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + @javax.annotation.Nullable private WebhookEventDataRelationships relationships; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public WebhookEventData() { + public WebhookEventData() { } - public WebhookEventData type(String type) { - + public WebhookEventData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "webhook-event", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public WebhookEventData id(UUID id) { - + public WebhookEventData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public WebhookEventData attributes(WebhookEventDataAttributes attributes) { - + public WebhookEventData attributes(@javax.annotation.Nonnull WebhookEventDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventDataAttributes getAttributes() { return attributes; } - - public void setAttributes(WebhookEventDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull WebhookEventDataAttributes attributes) { this.attributes = attributes; } - public WebhookEventData relationships(WebhookEventDataRelationships relationships) { - + public WebhookEventData relationships(@javax.annotation.Nullable WebhookEventDataRelationships relationships) { this.relationships = relationships; return this; } - /** + /** * Get relationships * @return relationships - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public WebhookEventDataRelationships getRelationships() { return relationships; } - - public void setRelationships(WebhookEventDataRelationships relationships) { + public void setRelationships(@javax.annotation.Nullable WebhookEventDataRelationships relationships) { this.relationships = relationships; } - public WebhookEventData links(Map links) { - + public WebhookEventData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -165,23 +173,21 @@ public WebhookEventData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -227,5 +233,115 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventData is not found in the empty JSON string", WebhookEventData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + WebhookEventDataAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + WebhookEventDataRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventData + * @throws IOException if the JSON string is invalid with respect to WebhookEventData + */ + public static WebhookEventData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventData.class); + } + + /** + * Convert an instance of WebhookEventData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataAttributes.java b/src/main/java/com/vertexvis/model/WebhookEventDataAttributes.java index b4bc3b2..09a0f66 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataAttributes.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataAttributes.java @@ -14,79 +14,129 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookEventDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; public static final String SERIALIZED_NAME_TOPIC = "topic"; @SerializedName(SERIALIZED_NAME_TOPIC) + @javax.annotation.Nonnull private String topic; - public WebhookEventDataAttributes() { + public static final String SERIALIZED_NAME_CHANGED = "changed"; + @SerializedName(SERIALIZED_NAME_CHANGED) + @javax.annotation.Nullable + private List changed = new ArrayList<>(); + + public WebhookEventDataAttributes() { } - public WebhookEventDataAttributes created(OffsetDateTime created) { - + public WebhookEventDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } - public WebhookEventDataAttributes topic(String topic) { - + public WebhookEventDataAttributes topic(@javax.annotation.Nonnull String topic) { this.topic = topic; return this; } - /** + /** * Get topic * @return topic - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "some-string", required = true, value = "") - public String getTopic() { return topic; } - - public void setTopic(String topic) { + public void setTopic(@javax.annotation.Nonnull String topic) { this.topic = topic; } + public WebhookEventDataAttributes changed(@javax.annotation.Nullable List changed) { + this.changed = changed; + return this; + } + + public WebhookEventDataAttributes addChangedItem(String changedItem) { + if (this.changed == null) { + this.changed = new ArrayList<>(); + } + this.changed.add(changedItem); + return this; + } + + /** + * Get changed + * @return changed + */ + @javax.annotation.Nullable + public List getChanged() { + return changed; + } + + public void setChanged(@javax.annotation.Nullable List changed) { + this.changed = changed; + } + + + @Override public boolean equals(Object o) { if (this == o) { @@ -97,12 +147,13 @@ public boolean equals(Object o) { } WebhookEventDataAttributes webhookEventDataAttributes = (WebhookEventDataAttributes) o; return Objects.equals(this.created, webhookEventDataAttributes.created) && - Objects.equals(this.topic, webhookEventDataAttributes.topic); + Objects.equals(this.topic, webhookEventDataAttributes.topic) && + Objects.equals(this.changed, webhookEventDataAttributes.changed); } @Override public int hashCode() { - return Objects.hash(created, topic); + return Objects.hash(created, topic, changed); } @Override @@ -111,6 +162,7 @@ public String toString() { sb.append("class WebhookEventDataAttributes {\n"); sb.append(" created: ").append(toIndentedString(created)).append("\n"); sb.append(" topic: ").append(toIndentedString(topic)).append("\n"); + sb.append(" changed: ").append(toIndentedString(changed)).append("\n"); sb.append("}"); return sb.toString(); } @@ -126,5 +178,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("topic"); + openapiFields.add("changed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("topic"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataAttributes is not found in the empty JSON string", WebhookEventDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("topic").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `topic` to be a primitive type in the JSON string but got `%s`", jsonObj.get("topic").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("changed") != null && !jsonObj.get("changed").isJsonNull() && !jsonObj.get("changed").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `changed` to be an array in the JSON string but got `%s`", jsonObj.get("changed").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataAttributes + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataAttributes + */ + public static WebhookEventDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataAttributes.class); + } + + /** + * Convert an instance of WebhookEventDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataRelationships.java b/src/main/java/com/vertexvis/model/WebhookEventDataRelationships.java index 7b88657..c9adeb7 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataRelationships.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataRelationships.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,72 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.WebhookEventDataRelationshipsOwner; import com.vertexvis.model.WebhookEventDataRelationshipsResource; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookEventDataRelationships */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataRelationships { public static final String SERIALIZED_NAME_OWNER = "owner"; @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nonnull private WebhookEventDataRelationshipsOwner owner; public static final String SERIALIZED_NAME_RESOURCE = "resource"; @SerializedName(SERIALIZED_NAME_RESOURCE) + @javax.annotation.Nonnull private WebhookEventDataRelationshipsResource resource; - public WebhookEventDataRelationships() { + public WebhookEventDataRelationships() { } - public WebhookEventDataRelationships owner(WebhookEventDataRelationshipsOwner owner) { - + public WebhookEventDataRelationships owner(@javax.annotation.Nonnull WebhookEventDataRelationshipsOwner owner) { this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventDataRelationshipsOwner getOwner() { return owner; } - - public void setOwner(WebhookEventDataRelationshipsOwner owner) { + public void setOwner(@javax.annotation.Nonnull WebhookEventDataRelationshipsOwner owner) { this.owner = owner; } - public WebhookEventDataRelationships resource(WebhookEventDataRelationshipsResource resource) { - + public WebhookEventDataRelationships resource(@javax.annotation.Nonnull WebhookEventDataRelationshipsResource resource) { this.resource = resource; return this; } - /** + /** * Get resource * @return resource - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventDataRelationshipsResource getResource() { return resource; } - - public void setResource(WebhookEventDataRelationshipsResource resource) { + public void setResource(@javax.annotation.Nonnull WebhookEventDataRelationshipsResource resource) { this.resource = resource; } + @Override public boolean equals(Object o) { if (this == o) { @@ -127,5 +143,103 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("owner"); + openapiFields.add("resource"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("resource"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataRelationships is not found in the empty JSON string", WebhookEventDataRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `owner` + WebhookEventDataRelationshipsOwner.validateJsonElement(jsonObj.get("owner")); + // validate the required field `resource` + WebhookEventDataRelationshipsResource.validateJsonElement(jsonObj.get("resource")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataRelationships + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataRelationships + */ + public static WebhookEventDataRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataRelationships.class); + } + + /** + * Convert an instance of WebhookEventDataRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwner.java b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwner.java index a49af03..4d5a938 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwner.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwner.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,73 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RelationshipLinks; import com.vertexvis.model.WebhookEventDataRelationshipsOwnerData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to an `owner`. */ -@ApiModel(description = "Relationship to an `owner`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataRelationshipsOwner { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private WebhookEventDataRelationshipsOwnerData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable private RelationshipLinks links; - public WebhookEventDataRelationshipsOwner() { + public WebhookEventDataRelationshipsOwner() { } - public WebhookEventDataRelationshipsOwner data(WebhookEventDataRelationshipsOwnerData data) { - + public WebhookEventDataRelationshipsOwner data(@javax.annotation.Nonnull WebhookEventDataRelationshipsOwnerData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventDataRelationshipsOwnerData getData() { return data; } - - public void setData(WebhookEventDataRelationshipsOwnerData data) { + public void setData(@javax.annotation.Nonnull WebhookEventDataRelationshipsOwnerData data) { this.data = data; } - public WebhookEventDataRelationshipsOwner links(RelationshipLinks links) { - + public WebhookEventDataRelationshipsOwner links(@javax.annotation.Nullable RelationshipLinks links) { this.links = links; return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public RelationshipLinks getLinks() { return links; } - - public void setLinks(RelationshipLinks links) { + public void setLinks(@javax.annotation.Nullable RelationshipLinks links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -128,5 +143,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataRelationshipsOwner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataRelationshipsOwner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataRelationshipsOwner is not found in the empty JSON string", WebhookEventDataRelationshipsOwner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataRelationshipsOwner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataRelationshipsOwner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataRelationshipsOwner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + WebhookEventDataRelationshipsOwnerData.validateJsonElement(jsonObj.get("data")); + // validate the optional field `links` + if (jsonObj.get("links") != null && !jsonObj.get("links").isJsonNull()) { + RelationshipLinks.validateJsonElement(jsonObj.get("links")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataRelationshipsOwner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataRelationshipsOwner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataRelationshipsOwner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataRelationshipsOwner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataRelationshipsOwner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataRelationshipsOwner given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataRelationshipsOwner + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataRelationshipsOwner + */ + public static WebhookEventDataRelationshipsOwner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataRelationshipsOwner.class); + } + + /** + * Convert an instance of WebhookEventDataRelationshipsOwner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwnerData.java b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwnerData.java index 3d61241..86290e4 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwnerData.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsOwnerData.java @@ -14,21 +14,42 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookEventDataRelationshipsOwnerData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataRelationshipsOwnerData { /** * Resource object type. @@ -73,65 +94,65 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { return TypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public WebhookEventDataRelationshipsOwnerData() { + public WebhookEventDataRelationshipsOwnerData() { } - public WebhookEventDataRelationshipsOwnerData type(TypeEnum type) { - + public WebhookEventDataRelationshipsOwnerData type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "account", required = true, value = "Resource object type.") - public TypeEnum getType() { return type; } - - public void setType(TypeEnum type) { + public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } - public WebhookEventDataRelationshipsOwnerData id(UUID id) { - + public WebhookEventDataRelationshipsOwnerData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -171,5 +192,107 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataRelationshipsOwnerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataRelationshipsOwnerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataRelationshipsOwnerData is not found in the empty JSON string", WebhookEventDataRelationshipsOwnerData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataRelationshipsOwnerData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataRelationshipsOwnerData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataRelationshipsOwnerData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataRelationshipsOwnerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataRelationshipsOwnerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataRelationshipsOwnerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataRelationshipsOwnerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataRelationshipsOwnerData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataRelationshipsOwnerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataRelationshipsOwnerData + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataRelationshipsOwnerData + */ + public static WebhookEventDataRelationshipsOwnerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataRelationshipsOwnerData.class); + } + + /** + * Convert an instance of WebhookEventDataRelationshipsOwnerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResource.java b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResource.java index 2dc5948..7ee301c 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResource.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResource.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,73 +21,89 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.RelationshipLinks; import com.vertexvis.model.WebhookEventDataRelationshipsResourceData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * Relationship to a `resource`. */ -@ApiModel(description = "Relationship to a `resource`.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataRelationshipsResource { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private WebhookEventDataRelationshipsResourceData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable private RelationshipLinks links; - public WebhookEventDataRelationshipsResource() { + public WebhookEventDataRelationshipsResource() { } - public WebhookEventDataRelationshipsResource data(WebhookEventDataRelationshipsResourceData data) { - + public WebhookEventDataRelationshipsResource data(@javax.annotation.Nonnull WebhookEventDataRelationshipsResourceData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventDataRelationshipsResourceData getData() { return data; } - - public void setData(WebhookEventDataRelationshipsResourceData data) { + public void setData(@javax.annotation.Nonnull WebhookEventDataRelationshipsResourceData data) { this.data = data; } - public WebhookEventDataRelationshipsResource links(RelationshipLinks links) { - + public WebhookEventDataRelationshipsResource links(@javax.annotation.Nullable RelationshipLinks links) { this.links = links; return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public RelationshipLinks getLinks() { return links; } - - public void setLinks(RelationshipLinks links) { + public void setLinks(@javax.annotation.Nullable RelationshipLinks links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -128,5 +143,104 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataRelationshipsResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataRelationshipsResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataRelationshipsResource is not found in the empty JSON string", WebhookEventDataRelationshipsResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataRelationshipsResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataRelationshipsResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataRelationshipsResource.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + WebhookEventDataRelationshipsResourceData.validateJsonElement(jsonObj.get("data")); + // validate the optional field `links` + if (jsonObj.get("links") != null && !jsonObj.get("links").isJsonNull()) { + RelationshipLinks.validateJsonElement(jsonObj.get("links")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataRelationshipsResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataRelationshipsResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataRelationshipsResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataRelationshipsResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataRelationshipsResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataRelationshipsResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataRelationshipsResource + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataRelationshipsResource + */ + public static WebhookEventDataRelationshipsResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataRelationshipsResource.class); + } + + /** + * Convert an instance of WebhookEventDataRelationshipsResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResourceData.java b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResourceData.java index c0532e0..35d5571 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResourceData.java +++ b/src/main/java/com/vertexvis/model/WebhookEventDataRelationshipsResourceData.java @@ -14,79 +14,95 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookEventDataRelationshipsResourceData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventDataRelationshipsResourceData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; - public WebhookEventDataRelationshipsResourceData() { + public WebhookEventDataRelationshipsResourceData() { } - public WebhookEventDataRelationshipsResourceData type(String type) { - + public WebhookEventDataRelationshipsResourceData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Resource object type. * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "queued-scene-item", required = true, value = "Resource object type.") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public WebhookEventDataRelationshipsResourceData id(UUID id) { - + public WebhookEventDataRelationshipsResourceData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } + @Override public boolean equals(Object o) { if (this == o) { @@ -126,5 +142,105 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventDataRelationshipsResourceData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventDataRelationshipsResourceData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventDataRelationshipsResourceData is not found in the empty JSON string", WebhookEventDataRelationshipsResourceData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventDataRelationshipsResourceData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventDataRelationshipsResourceData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventDataRelationshipsResourceData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventDataRelationshipsResourceData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventDataRelationshipsResourceData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventDataRelationshipsResourceData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventDataRelationshipsResourceData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventDataRelationshipsResourceData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventDataRelationshipsResourceData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventDataRelationshipsResourceData + * @throws IOException if the JSON string is invalid with respect to WebhookEventDataRelationshipsResourceData + */ + public static WebhookEventDataRelationshipsResourceData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventDataRelationshipsResourceData.class); + } + + /** + * Convert an instance of WebhookEventDataRelationshipsResourceData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventIncludedInner.java b/src/main/java/com/vertexvis/model/WebhookEventIncludedInner.java new file mode 100644 index 0000000..1762321 --- /dev/null +++ b/src/main/java/com/vertexvis/model/WebhookEventIncludedInner.java @@ -0,0 +1,280 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.WebhookEventPartRevisionIncludedAttributes; +import com.vertexvis.model.WebhookEventPartRevisionIncludedData; +import com.vertexvis.model.WebhookEventSceneIncludedData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class WebhookEventIncludedInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(WebhookEventIncludedInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventIncludedInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventIncludedInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterWebhookEventSceneIncludedData = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventSceneIncludedData.class)); + final TypeAdapter adapterWebhookEventPartRevisionIncludedData = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventPartRevisionIncludedData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventIncludedInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `WebhookEventSceneIncludedData` + if (value.getActualInstance() instanceof WebhookEventSceneIncludedData) { + JsonElement element = adapterWebhookEventSceneIncludedData.toJsonTree((WebhookEventSceneIncludedData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `WebhookEventPartRevisionIncludedData` + if (value.getActualInstance() instanceof WebhookEventPartRevisionIncludedData) { + JsonElement element = adapterWebhookEventPartRevisionIncludedData.toJsonTree((WebhookEventPartRevisionIncludedData)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData"); + } + + @Override + public WebhookEventIncludedInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize WebhookEventSceneIncludedData + try { + // validate the JSON object to see if any exception is thrown + WebhookEventSceneIncludedData.validateJsonElement(jsonElement); + actualAdapter = adapterWebhookEventSceneIncludedData; + match++; + log.log(Level.FINER, "Input data matches schema 'WebhookEventSceneIncludedData'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for WebhookEventSceneIncludedData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'WebhookEventSceneIncludedData'", e); + } + // deserialize WebhookEventPartRevisionIncludedData + try { + // validate the JSON object to see if any exception is thrown + WebhookEventPartRevisionIncludedData.validateJsonElement(jsonElement); + actualAdapter = adapterWebhookEventPartRevisionIncludedData; + match++; + log.log(Level.FINER, "Input data matches schema 'WebhookEventPartRevisionIncludedData'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for WebhookEventPartRevisionIncludedData failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'WebhookEventPartRevisionIncludedData'", e); + } + + if (match == 1) { + WebhookEventIncludedInner ret = new WebhookEventIncludedInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for WebhookEventIncludedInner: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public WebhookEventIncludedInner() { + super("oneOf", Boolean.FALSE); + } + + public WebhookEventIncludedInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("WebhookEventSceneIncludedData", WebhookEventSceneIncludedData.class); + schemas.put("WebhookEventPartRevisionIncludedData", WebhookEventPartRevisionIncludedData.class); + } + + @Override + public Map> getSchemas() { + return WebhookEventIncludedInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof WebhookEventSceneIncludedData) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof WebhookEventPartRevisionIncludedData) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData"); + } + + /** + * Get the actual instance, which can be the following: + * WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData + * + * @return The actual instance (WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `WebhookEventSceneIncludedData`. If the actual instance is not `WebhookEventSceneIncludedData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `WebhookEventSceneIncludedData` + * @throws ClassCastException if the instance is not `WebhookEventSceneIncludedData` + */ + public WebhookEventSceneIncludedData getWebhookEventSceneIncludedData() throws ClassCastException { + return (WebhookEventSceneIncludedData)super.getActualInstance(); + } + + /** + * Get the actual instance of `WebhookEventPartRevisionIncludedData`. If the actual instance is not `WebhookEventPartRevisionIncludedData`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `WebhookEventPartRevisionIncludedData` + * @throws ClassCastException if the instance is not `WebhookEventPartRevisionIncludedData` + */ + public WebhookEventPartRevisionIncludedData getWebhookEventPartRevisionIncludedData() throws ClassCastException { + return (WebhookEventPartRevisionIncludedData)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventIncludedInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with WebhookEventSceneIncludedData + try { + WebhookEventSceneIncludedData.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for WebhookEventSceneIncludedData failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with WebhookEventPartRevisionIncludedData + try { + WebhookEventPartRevisionIncludedData.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for WebhookEventPartRevisionIncludedData failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for WebhookEventIncludedInner with oneOf schemas: WebhookEventPartRevisionIncludedData, WebhookEventSceneIncludedData. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of WebhookEventIncludedInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventIncludedInner + * @throws IOException if the JSON string is invalid with respect to WebhookEventIncludedInner + */ + public static WebhookEventIncludedInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventIncludedInner.class); + } + + /** + * Convert an instance of WebhookEventIncludedInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedAttributes.java b/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedAttributes.java index a2f7e2b..1339567 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedAttributes.java +++ b/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedAttributes.java @@ -14,133 +14,143 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookEventPartRevisionIncludedAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventPartRevisionIncludedAttributes { public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nullable private OffsetDateTime created; public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) + @javax.annotation.Nullable private String suppliedId; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_PART_NAME = "partName"; @SerializedName(SERIALIZED_NAME_PART_NAME) + @javax.annotation.Nullable private String partName; - public WebhookEventPartRevisionIncludedAttributes() { + public WebhookEventPartRevisionIncludedAttributes() { } - public WebhookEventPartRevisionIncludedAttributes created(OffsetDateTime created) { - + public WebhookEventPartRevisionIncludedAttributes created(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "2020-01-01T12:00Z", value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { this.created = created; } - public WebhookEventPartRevisionIncludedAttributes suppliedId(String suppliedId) { - + public WebhookEventPartRevisionIncludedAttributes suppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; return this; } - /** + /** * Get suppliedId * @return suppliedId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getSuppliedId() { return suppliedId; } - - public void setSuppliedId(String suppliedId) { + public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { this.suppliedId = suppliedId; } - public WebhookEventPartRevisionIncludedAttributes name(String name) { - + public WebhookEventPartRevisionIncludedAttributes name(@javax.annotation.Nullable String name) { this.name = name; return this; } - /** + /** * Get name * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getName() { return name; } - - public void setName(String name) { + public void setName(@javax.annotation.Nullable String name) { this.name = name; } - public WebhookEventPartRevisionIncludedAttributes partName(String partName) { - + public WebhookEventPartRevisionIncludedAttributes partName(@javax.annotation.Nullable String partName) { this.partName = partName; return this; } - /** + /** * Get partName * @return partName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "some-string", value = "") - public String getPartName() { return partName; } - - public void setPartName(String partName) { + public void setPartName(@javax.annotation.Nullable String partName) { this.partName = partName; } + @Override public boolean equals(Object o) { if (this == o) { @@ -184,5 +194,101 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("created"); + openapiFields.add("suppliedId"); + openapiFields.add("name"); + openapiFields.add("partName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventPartRevisionIncludedAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventPartRevisionIncludedAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventPartRevisionIncludedAttributes is not found in the empty JSON string", WebhookEventPartRevisionIncludedAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventPartRevisionIncludedAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventPartRevisionIncludedAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("suppliedId") != null && !jsonObj.get("suppliedId").isJsonNull()) && !jsonObj.get("suppliedId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suppliedId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suppliedId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("partName") != null && !jsonObj.get("partName").isJsonNull()) && !jsonObj.get("partName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `partName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("partName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventPartRevisionIncludedAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventPartRevisionIncludedAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventPartRevisionIncludedAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventPartRevisionIncludedAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventPartRevisionIncludedAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventPartRevisionIncludedAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventPartRevisionIncludedAttributes + * @throws IOException if the JSON string is invalid with respect to WebhookEventPartRevisionIncludedAttributes + */ + public static WebhookEventPartRevisionIncludedAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventPartRevisionIncludedAttributes.class); + } + + /** + * Convert an instance of WebhookEventPartRevisionIncludedAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedData.java b/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedData.java index 95b04db..cc59a80 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedData.java +++ b/src/main/java/com/vertexvis/model/WebhookEventPartRevisionIncludedData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,135 +21,148 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.WebhookEventPartRevisionIncludedAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookEventPartRevisionIncludedData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventPartRevisionIncludedData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private WebhookEventPartRevisionIncludedAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public WebhookEventPartRevisionIncludedData() { + public WebhookEventPartRevisionIncludedData() { } - public WebhookEventPartRevisionIncludedData type(String type) { - + public WebhookEventPartRevisionIncludedData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "part-revision", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public WebhookEventPartRevisionIncludedData id(UUID id) { - + public WebhookEventPartRevisionIncludedData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public WebhookEventPartRevisionIncludedData attributes(WebhookEventPartRevisionIncludedAttributes attributes) { - + public WebhookEventPartRevisionIncludedData attributes(@javax.annotation.Nonnull WebhookEventPartRevisionIncludedAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventPartRevisionIncludedAttributes getAttributes() { return attributes; } - - public void setAttributes(WebhookEventPartRevisionIncludedAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull WebhookEventPartRevisionIncludedAttributes attributes) { this.attributes = attributes; } - public WebhookEventPartRevisionIncludedData links(Map links) { - + public WebhookEventPartRevisionIncludedData links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public WebhookEventPartRevisionIncludedData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -194,5 +206,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventPartRevisionIncludedData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventPartRevisionIncludedData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventPartRevisionIncludedData is not found in the empty JSON string", WebhookEventPartRevisionIncludedData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventPartRevisionIncludedData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventPartRevisionIncludedData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventPartRevisionIncludedData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + WebhookEventPartRevisionIncludedAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventPartRevisionIncludedData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventPartRevisionIncludedData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventPartRevisionIncludedData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventPartRevisionIncludedData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventPartRevisionIncludedData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventPartRevisionIncludedData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventPartRevisionIncludedData + * @throws IOException if the JSON string is invalid with respect to WebhookEventPartRevisionIncludedData + */ + public static WebhookEventPartRevisionIncludedData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventPartRevisionIncludedData.class); + } + + /** + * Convert an instance of WebhookEventPartRevisionIncludedData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedAttributes.java b/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedAttributes.java index 68c5de4..f382c57 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedAttributes.java +++ b/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedAttributes.java @@ -14,33 +14,53 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookEventSceneIncludedAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventSceneIncludedAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) - private Map metadata = null; + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); - public WebhookEventSceneIncludedAttributes() { + public WebhookEventSceneIncludedAttributes() { } - public WebhookEventSceneIncludedAttributes metadata(Map metadata) { - + public WebhookEventSceneIncludedAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } @@ -53,23 +73,21 @@ public WebhookEventSceneIncludedAttributes putMetadataItem(String key, String me return this; } - /** + /** * User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. * @return metadata - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "User supplied key-value pairs for a scene. You can supply up to 50 entries, with key names limited to 64 characters and values limited to 256 characters. ") - public Map getMetadata() { return metadata; } - - public void setMetadata(Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } + @Override public boolean equals(Object o) { if (this == o) { @@ -107,5 +125,89 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventSceneIncludedAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventSceneIncludedAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventSceneIncludedAttributes is not found in the empty JSON string", WebhookEventSceneIncludedAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventSceneIncludedAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventSceneIncludedAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventSceneIncludedAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventSceneIncludedAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventSceneIncludedAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventSceneIncludedAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventSceneIncludedAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventSceneIncludedAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventSceneIncludedAttributes + * @throws IOException if the JSON string is invalid with respect to WebhookEventSceneIncludedAttributes + */ + public static WebhookEventSceneIncludedAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventSceneIncludedAttributes.class); + } + + /** + * Convert an instance of WebhookEventSceneIncludedAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedData.java b/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedData.java index 41f2c9a..d9f21b9 100644 --- a/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedData.java +++ b/src/main/java/com/vertexvis/model/WebhookEventSceneIncludedData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,135 +21,148 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.WebhookEventSceneIncludedAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookEventSceneIncludedData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookEventSceneIncludedData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private WebhookEventSceneIncludedAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public WebhookEventSceneIncludedData() { + public WebhookEventSceneIncludedData() { } - public WebhookEventSceneIncludedData type(String type) { - + public WebhookEventSceneIncludedData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "scene", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public WebhookEventSceneIncludedData id(UUID id) { - + public WebhookEventSceneIncludedData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public WebhookEventSceneIncludedData attributes(WebhookEventSceneIncludedAttributes attributes) { - + public WebhookEventSceneIncludedData attributes(@javax.annotation.Nonnull WebhookEventSceneIncludedAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookEventSceneIncludedAttributes getAttributes() { return attributes; } - - public void setAttributes(WebhookEventSceneIncludedAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull WebhookEventSceneIncludedAttributes attributes) { this.attributes = attributes; } - public WebhookEventSceneIncludedData links(Map links) { - + public WebhookEventSceneIncludedData links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public WebhookEventSceneIncludedData putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -194,5 +206,111 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEventSceneIncludedData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEventSceneIncludedData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEventSceneIncludedData is not found in the empty JSON string", WebhookEventSceneIncludedData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookEventSceneIncludedData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookEventSceneIncludedData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookEventSceneIncludedData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + WebhookEventSceneIncludedAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEventSceneIncludedData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEventSceneIncludedData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEventSceneIncludedData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEventSceneIncludedData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookEventSceneIncludedData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookEventSceneIncludedData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEventSceneIncludedData + * @throws IOException if the JSON string is invalid with respect to WebhookEventSceneIncludedData + */ + public static WebhookEventSceneIncludedData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEventSceneIncludedData.class); + } + + /** + * Convert an instance of WebhookEventSceneIncludedData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookSubscription.java b/src/main/java/com/vertexvis/model/WebhookSubscription.java index 35978cc..a54d285 100644 --- a/src/main/java/com/vertexvis/model/WebhookSubscription.java +++ b/src/main/java/com/vertexvis/model/WebhookSubscription.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,54 +21,72 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.WebhookSubscriptionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookSubscription */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookSubscription { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private WebhookSubscriptionData data; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public WebhookSubscription() { + public WebhookSubscription() { } - public WebhookSubscription data(WebhookSubscriptionData data) { - + public WebhookSubscription data(@javax.annotation.Nonnull WebhookSubscriptionData data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookSubscriptionData getData() { return data; } - - public void setData(WebhookSubscriptionData data) { + public void setData(@javax.annotation.Nonnull WebhookSubscriptionData data) { this.data = data; } - public WebhookSubscription links(Map links) { - + public WebhookSubscription links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -82,23 +99,21 @@ public WebhookSubscription putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -138,5 +153,100 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscription is not found in the empty JSON string", WebhookSubscription.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookSubscription.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookSubscription` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscription.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + WebhookSubscriptionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscription.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscription value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscription given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscription + * @throws IOException if the JSON string is invalid with respect to WebhookSubscription + */ + public static WebhookSubscription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscription.class); + } + + /** + * Convert an instance of WebhookSubscription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookSubscriptionData.java b/src/main/java/com/vertexvis/model/WebhookSubscriptionData.java index ca36ab9..19cf2aa 100644 --- a/src/main/java/com/vertexvis/model/WebhookSubscriptionData.java +++ b/src/main/java/com/vertexvis/model/WebhookSubscriptionData.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,109 +21,121 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.WebhookSubscriptionDataAttributes; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookSubscriptionData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookSubscriptionData { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull private String type; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull private UUID id; public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nonnull private WebhookSubscriptionDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) - private Map links = null; + @javax.annotation.Nullable + private Map links = new HashMap<>(); - public WebhookSubscriptionData() { + public WebhookSubscriptionData() { } - public WebhookSubscriptionData type(String type) { - + public WebhookSubscriptionData type(@javax.annotation.Nonnull String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "webhook-subscription", required = true, value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nonnull String type) { this.type = type; } - public WebhookSubscriptionData id(UUID id) { - + public WebhookSubscriptionData id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } - /** + /** * ID of the resource. * @return id - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "f79d4760-0b71-44e4-ad0b-22743fdd4ca3", required = true, value = "ID of the resource.") - public UUID getId() { return id; } - - public void setId(UUID id) { + public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } - public WebhookSubscriptionData attributes(WebhookSubscriptionDataAttributes attributes) { - + public WebhookSubscriptionData attributes(@javax.annotation.Nonnull WebhookSubscriptionDataAttributes attributes) { this.attributes = attributes; return this; } - /** + /** * Get attributes * @return attributes - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public WebhookSubscriptionDataAttributes getAttributes() { return attributes; } - - public void setAttributes(WebhookSubscriptionDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull WebhookSubscriptionDataAttributes attributes) { this.attributes = attributes; } - public WebhookSubscriptionData links(Map links) { - + public WebhookSubscriptionData links(@javax.annotation.Nullable Map links) { this.links = links; return this; } @@ -137,23 +148,21 @@ public WebhookSubscriptionData putLinksItem(String key, Link linksItem) { return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nullable Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -197,5 +206,110 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionData is not found in the empty JSON string", WebhookSubscriptionData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookSubscriptionData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookSubscriptionData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + WebhookSubscriptionDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionData + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionData + */ + public static WebhookSubscriptionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionData.class); + } + + /** + * Convert an instance of WebhookSubscriptionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookSubscriptionDataAttributes.java b/src/main/java/com/vertexvis/model/WebhookSubscriptionDataAttributes.java index fe5b26c..cbc7d6c 100644 --- a/src/main/java/com/vertexvis/model/WebhookSubscriptionDataAttributes.java +++ b/src/main/java/com/vertexvis/model/WebhookSubscriptionDataAttributes.java @@ -14,34 +14,58 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; /** * WebhookSubscriptionDataAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookSubscriptionDataAttributes { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull private String url; public static final String SERIALIZED_NAME_SECRET = "secret"; @SerializedName(SERIALIZED_NAME_SECRET) + @javax.annotation.Nullable private String secret; public static final String SERIALIZED_NAME_TOPICS = "topics"; @SerializedName(SERIALIZED_NAME_TOPICS) + @javax.annotation.Nonnull private List topics = new ArrayList<>(); /** @@ -89,139 +113,130 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { return StatusEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } } public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull private StatusEnum status; public static final String SERIALIZED_NAME_CREATED = "created"; @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull private OffsetDateTime created; - public WebhookSubscriptionDataAttributes() { + public WebhookSubscriptionDataAttributes() { } - public WebhookSubscriptionDataAttributes url(String url) { - + public WebhookSubscriptionDataAttributes url(@javax.annotation.Nonnull String url) { this.url = url; return this; } - /** + /** * Get url * @return url - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public String getUrl() { return url; } - - public void setUrl(String url) { + public void setUrl(@javax.annotation.Nonnull String url) { this.url = url; } - public WebhookSubscriptionDataAttributes secret(String secret) { - + public WebhookSubscriptionDataAttributes secret(@javax.annotation.Nullable String secret) { this.secret = secret; return this; } - /** + /** * Get secret * @return secret - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(example = "i3MFRDOmg1pxD36dGCTONRwOujkgV8m9LQ", value = "") - public String getSecret() { return secret; } - - public void setSecret(String secret) { + public void setSecret(@javax.annotation.Nullable String secret) { this.secret = secret; } - public WebhookSubscriptionDataAttributes topics(List topics) { - + public WebhookSubscriptionDataAttributes topics(@javax.annotation.Nonnull List topics) { this.topics = topics; return this; } public WebhookSubscriptionDataAttributes addTopicsItem(String topicsItem) { + if (this.topics == null) { + this.topics = new ArrayList<>(); + } this.topics.add(topicsItem); return this; } - /** + /** * Get topics * @return topics - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getTopics() { return topics; } - - public void setTopics(List topics) { + public void setTopics(@javax.annotation.Nonnull List topics) { this.topics = topics; } - public WebhookSubscriptionDataAttributes status(StatusEnum status) { - + public WebhookSubscriptionDataAttributes status(@javax.annotation.Nonnull StatusEnum status) { this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "active", required = true, value = "") - public StatusEnum getStatus() { return status; } - - public void setStatus(StatusEnum status) { + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { this.status = status; } - public WebhookSubscriptionDataAttributes created(OffsetDateTime created) { - + public WebhookSubscriptionDataAttributes created(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; return this; } - /** + /** * Get created * @return created - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(example = "2020-01-01T12:00Z", required = true, value = "") - public OffsetDateTime getCreated() { return created; } - - public void setCreated(OffsetDateTime created) { + public void setCreated(@javax.annotation.Nonnull OffsetDateTime created) { this.created = created; } + @Override public boolean equals(Object o) { if (this == o) { @@ -267,5 +282,121 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("secret"); + openapiFields.add("topics"); + openapiFields.add("status"); + openapiFields.add("created"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("topics"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("created"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionDataAttributes is not found in the empty JSON string", WebhookSubscriptionDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookSubscriptionDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookSubscriptionDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("secret") != null && !jsonObj.get("secret").isJsonNull()) && !jsonObj.get("secret").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secret` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secret").toString())); + } + // ensure the required json array is present + if (jsonObj.get("topics") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("topics").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `topics` to be an array in the JSON string but got `%s`", jsonObj.get("topics").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionDataAttributes + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionDataAttributes + */ + public static WebhookSubscriptionDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionDataAttributes.class); + } + + /** + * Convert an instance of WebhookSubscriptionDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/WebhookSubscriptionList.java b/src/main/java/com/vertexvis/model/WebhookSubscriptionList.java index e616e19..e102d44 100644 --- a/src/main/java/com/vertexvis/model/WebhookSubscriptionList.java +++ b/src/main/java/com/vertexvis/model/WebhookSubscriptionList.java @@ -14,7 +14,6 @@ package com.vertexvis.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -22,86 +21,109 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.Link; import com.vertexvis.model.WebhookSubscriptionData; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vertexvis.JSON; + /** * WebhookSubscriptionList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class WebhookSubscriptionList { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull private List data = new ArrayList<>(); public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull private Map links = new HashMap<>(); - public WebhookSubscriptionList() { + public WebhookSubscriptionList() { } - public WebhookSubscriptionList data(List data) { - + public WebhookSubscriptionList data(@javax.annotation.Nonnull List data) { this.data = data; return this; } public WebhookSubscriptionList addDataItem(WebhookSubscriptionData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } this.data.add(dataItem); return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public List getData() { return data; } - - public void setData(List data) { + public void setData(@javax.annotation.Nonnull List data) { this.data = data; } - public WebhookSubscriptionList links(Map links) { - + public WebhookSubscriptionList links(@javax.annotation.Nonnull Map links) { this.links = links; return this; } public WebhookSubscriptionList putLinksItem(String key, Link linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } this.links.put(key, linksItem); return this; } - /** + /** * Get links * @return links - **/ + */ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - public Map getLinks() { return links; } - - public void setLinks(Map links) { + public void setLinks(@javax.annotation.Nonnull Map links) { this.links = links; } + @Override public boolean equals(Object o) { if (this == o) { @@ -141,5 +163,109 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("links"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionList is not found in the empty JSON string", WebhookSubscriptionList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookSubscriptionList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookSubscriptionList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + WebhookSubscriptionData.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionList given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionList + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionList + */ + public static WebhookSubscriptionList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionList.class); + } + + /** + * Convert an instance of WebhookSubscriptionList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfCameraCameraFitTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfCameraCameraFitTypeAdapter.java deleted file mode 100644 index c1c56cf..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfCameraCameraFitTypeAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfCameraCameraFit; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfCameraCameraFitTypeAdapter extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfCameraCameraFitTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfCameraCameraFit value) throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getCam())); - } - - @Override - public AnyOfCameraCameraFit read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter.java deleted file mode 100644 index 5adfdd4..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter - extends - TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfChangeVisibilityOperationChangeMaterialOperationClearMaterialOperationChangeTransformOperationClearTransformOperationSelectOperationDeselectOperationTypeAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, - AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getOperation())); - } - - @Override - public AnyOfChangeVisibilityOpChangeMaterialOpClearMaterialOpChangeTransformOpClearTransformOpSelectOpDeselectOperationClearRenOpViewDefaultRenOpViewRenByIdOpViewRenBySuppliedIdOpViewRepByIdOpViewRepByPredefinedIdOpClearRepOp read( - JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfCreateSceneItemRequestDataAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfCreateSceneItemRequestDataAdapter.java deleted file mode 100644 index acbbe93..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfCreateSceneItemRequestDataAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfCreateSceneItemRequestData; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfCreateSceneItemRequestDataAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfCreateSceneItemRequestDataAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfCreateSceneItemRequestData value) throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getObj())); - } - - @Override - public AnyOfCreateSceneItemRequestData read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter.java deleted file mode 100644 index b4abbbf..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfFileRelationshipPartAssemblyRelationship; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; -import com.vertexvis.model.FileRelationship; -import com.vertexvis.model.FileRelationshipData; -import com.vertexvis.model.PartAssemblyRelationship; -import com.vertexvis.model.PartAssemblyRelationshipData; -import com.vertexvis.model.PartRevisionInstance; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Supplier; - -public class AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter extends TypeAdapter { - - private final Supplier gsonSupplier; - - public AnyOfFileRelationshipPartAssemblyRelationshipTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfFileRelationshipPartAssemblyRelationship value) throws IOException { - if (value.getFileRelationship() != null) { - out.jsonValue(gsonSupplier.get().toJson(value.getFileRelationship())); - } else { - out.jsonValue(gsonSupplier.get().toJson(value.getPartAssemblyRelationship())); - } - } - - @Override - public AnyOfFileRelationshipPartAssemblyRelationship read(JsonReader in) throws IOException { - List partRevisionInstances = new ArrayList<>(); - Map metadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeHashMap = new HashMap<>(); - FileRelationshipData.TypeEnum typeEnum = null; - UUID fileId = null; - boolean isPartAssemblyRelationship = false; - in.beginObject(); - while (in.hasNext()) { - switch (in.nextName()) { - case "data": - in.beginObject(); - break; - case "children": - isPartAssemblyRelationship = true; - Type listOfMyClassObject = new TypeToken>() { - }.getType(); - partRevisionInstances = gsonSupplier.get().fromJson(in, listOfMyClassObject); - break; - case "type": - typeEnum = FileRelationshipData.TypeEnum.fromValue(in.nextString()); - break; - case "id": - fileId = UUID.fromString(in.nextString()); - break; - case "metadata": - Type goingToFail = new TypeToken>() { - }.getType(); - try { - metadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeHashMap = gsonSupplier.get().fromJson(in, goingToFail); - } catch (Exception e) { - if (in.peek() != JsonToken.END_ARRAY) { - in.endArray(); - } - - } - break; - } - } - in.endObject(); - in.endObject(); - if (isPartAssemblyRelationship) { - return new AnyOfFileRelationshipPartAssemblyRelationship(new PartAssemblyRelationship() - .data(new PartAssemblyRelationshipData() - .children(partRevisionInstances).metadata(metadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeHashMap))); - } else { - return new AnyOfFileRelationshipPartAssemblyRelationship(new FileRelationship() - .data(new FileRelationshipData() - .type(typeEnum).id(fileId))); - } - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter.java deleted file mode 100644 index d1d6034..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfGeometrySetDataPartRevisionDataPartRenditionData; -import com.vertexvis.model.GeometrySetData; -import com.vertexvis.model.PartRendition; -import com.vertexvis.model.PartRenditionData; -import com.vertexvis.model.PartRevisionData; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter extends TypeAdapter -{ - private final Supplier gsonSupplier; - - public AnyOfGeometrySetDataPartRevisionDataPartRenditionDataTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfGeometrySetDataPartRevisionDataPartRenditionData value) - throws IOException { - if (value != null && value.getRel() != null) { - out.jsonValue(gsonSupplier.get().toJson(value.getRel())); - } - else { - out.jsonValue(null); - } - } - - @Override - public AnyOfGeometrySetDataPartRevisionDataPartRenditionData read(JsonReader in) throws IOException { - TypeAdapter jsonAdapter = gsonSupplier.get().getAdapter(JsonElement.class); - TypeAdapter partRevisionDataTypeAdapter = - gsonSupplier.get().getAdapter(TypeToken.get(PartRevisionData.class)); - TypeAdapter geometrySetDataTypeAdapter = - gsonSupplier.get().getAdapter(TypeToken.get(GeometrySetData.class)); - TypeAdapter partRenditionDataTypeAdapter = - gsonSupplier.get().getAdapter(TypeToken.get(PartRenditionData.class)); - - JsonObject json = jsonAdapter.read(in).getAsJsonObject(); - String type = json.get("type").getAsString(); - - return switch (type) { - case "part-revision" -> new AnyOfGeometrySetDataPartRevisionDataPartRenditionData( - partRevisionDataTypeAdapter.fromJsonTree(json) - ); - case "geometry-set" -> new AnyOfGeometrySetDataPartRevisionDataPartRenditionData( - geometrySetDataTypeAdapter.fromJsonTree(json) - ); - case "part-rendition" -> new AnyOfGeometrySetDataPartRevisionDataPartRenditionData( - partRenditionDataTypeAdapter.fromJsonTree(json) - ); - default -> throw new IOException("JSON deserializer not implemented for type " + type); - }; - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter.java deleted file mode 100644 index bfdc547..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship; -import com.vertexvis.model.GeometrySetRelationship; -import com.vertexvis.model.GeometrySetRelationshipData; -import com.vertexvis.model.PartDataRelationshipsPartRevisions; -import com.vertexvis.model.PartRevisionRelationship; -import com.vertexvis.model.SceneRelationship; -import com.vertexvis.model.SceneRelationshipData; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -public class AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipTypeAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, - AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getRel())); - } - - @Override - public AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship read(JsonReader in) - throws IOException { - String type = ""; - String id = ""; - - in.beginObject(); - while (in.hasNext()) { - switch (in.nextName()) { - case "data": - in.beginObject(); - break; - case "type": - type = in.nextString(); - break; - case "id": - id = in.nextString(); - break; - } - } - in.endObject(); - in.endObject(); - - switch (type) { - case "part-revision": - return new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - new PartRevisionRelationship().data(new PartDataRelationshipsPartRevisions() - .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION) - .id(UUID.fromString(id)))); - case "geometry-set": - return new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - new GeometrySetRelationship().data(new GeometrySetRelationshipData() - .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET).id(UUID.fromString(id)))); - case "scene": - return new AnyOfGeometrySetRelationshipPartRevisionRelationshipSceneRelationshipPartRenditionRelationship( - new SceneRelationship().data( - new SceneRelationshipData().type(SceneRelationshipData.TypeEnum.SCENE) - .id(UUID.fromString(id)))); - default: - return null; - } - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter.java deleted file mode 100644 index 1d1e239..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfGeometrySetRelationshipPartRevisionRelationship; -import com.vertexvis.model.GeometrySetRelationship; -import com.vertexvis.model.GeometrySetRelationshipData; -import com.vertexvis.model.PartDataRelationshipsPartRevisions; -import com.vertexvis.model.PartRevisionRelationship; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -public class AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfGeometrySetRelationshipPartRevisionRelationshipTypeAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfGeometrySetRelationshipPartRevisionRelationship value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getRel())); - } - - @Override - public AnyOfGeometrySetRelationshipPartRevisionRelationship read(JsonReader in) - throws IOException { - String type = ""; - String id = ""; - - in.beginObject(); - while (in.hasNext()) { - switch (in.nextName()) { - case "data": - in.beginObject(); - break; - case "type": - type = in.nextString(); - break; - case "id": - id = in.nextString(); - break; - } - } - in.endObject(); - in.endObject(); - - switch (type) { - case "part-revision": - return new AnyOfGeometrySetRelationshipPartRevisionRelationship( - new PartRevisionRelationship().data(new PartDataRelationshipsPartRevisions() - .type(PartDataRelationshipsPartRevisions.TypeEnum.PART_REVISION) - .id(UUID.fromString(id)))); - case "geometry-set": - return new AnyOfGeometrySetRelationshipPartRevisionRelationship( - new GeometrySetRelationship().data(new GeometrySetRelationshipData() - .type(GeometrySetRelationshipData.TypeEnum.GEOMETRY_SET).id(UUID.fromString(id)))); - default: - return null; - } - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter.java deleted file mode 100644 index cd2b83b..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType; -import com.vertexvis.model.MetadataDateType; -import com.vertexvis.model.MetadataFloatType; -import com.vertexvis.model.MetadataLongType; -import com.vertexvis.model.MetadataNullType; -import com.vertexvis.model.MetadataStringType; - -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.function.Supplier; - -public class AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter - extends - TypeAdapter { - - private final Supplier gsonSupplier; - - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, - AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getValue())); - } - - @Override - public AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType read( - JsonReader in) throws IOException { - in.beginObject(); - - String stringValue = null; - Double doubleValue = null; - String typeValue = null; - while (in.hasNext() && ((stringValue == null && doubleValue == null) - || typeValue == null)) { - var name = in.nextName(); - if (name.equals("type")) { - typeValue = in.nextString(); - } - else if (name.equals("value")) { - var token = in.peek(); - switch (token) { - case NUMBER: - doubleValue = in.nextDouble(); - break; - case STRING: - stringValue = in.nextString(); - break; - default: - throw new UnsupportedOperationException("Unexpected token"); - } - } - else { - in.skipValue(); - } - } - - if (typeValue == null || (stringValue == null && doubleValue == null && !typeValue.equals( - "null"))) { - throw new UnsupportedOperationException("Missing fields"); - } - - AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType - retval = null; - - // The type field always wins in case of ambiguity. - switch (typeValue) { - case "null": - if (!(stringValue == null && doubleValue == null)) { - throw new UnsupportedOperationException("Value type mismatch"); - } - - retval = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataNullType().type(typeValue)); - break; - case "long": - Long longValue = null; - if (doubleValue != null) { - var casted = doubleValue.longValue(); - if (((double) casted) != doubleValue) { - throw new UnsupportedOperationException("Value type mismatch"); - } - longValue = casted; - } - else { - try { - longValue = Long.parseLong(stringValue); - } - catch (Exception ignored) { - throw new UnsupportedOperationException("Value type mismatch"); - } - } - - retval = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataLongType().value(longValue).type(typeValue)); - break; - case "float": - Float floatValue = null; - if (doubleValue != null) { - floatValue = doubleValue.floatValue(); - } - else { - try { - floatValue = Float.parseFloat(stringValue); - } - catch (Exception ignored) { - throw new UnsupportedOperationException("Value type mismatch"); - } - } - - retval = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataFloatType().value(floatValue).type(typeValue)); - break; - case "date": - OffsetDateTime dateTimeValue = null; - if (stringValue != null) { - try { - dateTimeValue = OffsetDateTime.parse(stringValue); - } - catch (Exception ignored) { - throw new UnsupportedOperationException("Value type mismatch"); - } - } - else { - throw new UnsupportedOperationException("Value type mismatch"); - } - - retval = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataDateType().value(dateTimeValue).type(typeValue)); - break; - case "string": - retval = - new AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullType( - new MetadataStringType().value(stringValue).type(typeValue)); - break; - default: - throw new UnsupportedOperationException("Unknown metadata type"); - } - - in.endObject(); - - return retval; - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter.java deleted file mode 100644 index e8b8aa4..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfPerspectiveCameraOrthographicCameraCameraFit; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfPerspectiveCameraOrthographicCameraCameraFitTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfPerspectiveCameraOrthographicCameraCameraFit value) throws IOException { - if (value != null) { - out.jsonValue(gsonSupplier.get().toJson(value.getAnyOfCameraFit())); - } else { - out.nullValue(); - } - } - - @Override - public AnyOfPerspectiveCameraOrthographicCameraCameraFit read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} - diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter.java deleted file mode 100644 index f139d6c..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfQueryByIdQueryByCollectionQueryAll; - -import java.io.IOException; -import java.util.function.Supplier; - -public class AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfQueryByIdQueryByCollectionQueryAllTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, AnyOfQueryByIdQueryByCollectionQueryAll value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getQuery())); - } - - @Override - public AnyOfQueryByIdQueryByCollectionQueryAll read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/AnyOfRelationshipDataApiErrorAdapter.java b/src/main/java/com/vertexvis/model/serialization/AnyOfRelationshipDataApiErrorAdapter.java deleted file mode 100644 index c40599f..0000000 --- a/src/main/java/com/vertexvis/model/serialization/AnyOfRelationshipDataApiErrorAdapter.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.AnyOfRelationshipDataApiError; -import com.vertexvis.model.ApiError; -import com.vertexvis.model.ApiErrorSource; -import com.vertexvis.model.RelationshipData; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -public class AnyOfRelationshipDataApiErrorAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public AnyOfRelationshipDataApiErrorAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, - AnyOfRelationshipDataApiError value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getObj())); - } - - @Override - public AnyOfRelationshipDataApiError read(JsonReader in) - throws IOException { - String id = ""; - String type = null; - String status = null; - String code = null; - String title = null; - String detail = null; - boolean hasSource = false; - String pointer = null; - String parameter = null; - - in.beginObject(); - while (in.hasNext()) { - switch (in.nextName()) { - case "id": - id = in.nextString(); - break; - case "type": - type = in.nextString(); - break; - case "status": - status = in.nextString(); - break; - case "code": - code = in.nextString(); - break; - case "title": - title = in.nextString(); - break; - case "detail": - detail = in.nextString(); - break; - case "source": - hasSource = true; - in.beginObject(); - break; - case "pointer": - pointer = in.nextString(); - break; - case "parameter": - parameter = in.nextString(); - break; - } - } - in.endObject(); - if (hasSource) { - in.endObject(); - } - - if (!isNullOrEmpty(type)) { - return new AnyOfRelationshipDataApiError( - new RelationshipData().id(UUID.fromString(id)).type(type)); - } - - ApiError ae = new ApiError().id(id).status(status).code(code).title(title).detail(detail); - return new AnyOfRelationshipDataApiError( - hasSource ? ae.source(new ApiErrorSource().pointer(pointer).parameter(parameter)) : ae); - } - - private static boolean isNullOrEmpty(String s) { - return s == null || s.trim().length() == 0; - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter.java deleted file mode 100644 index 62cf867..0000000 --- a/src/main/java/com/vertexvis/model/serialization/OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.OneOfHitResultDataSceneItemDataPartRevisionData; - -import java.io.IOException; -import java.util.function.Supplier; - -public class OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public OneOfHitResultDataSceneItemDataPartRevisionDataTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, OneOfHitResultDataSceneItemDataPartRevisionData value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getData())); - } - - @Override - public OneOfHitResultDataSceneItemDataPartRevisionData read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Deserializing this is currently not supported."); - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/OneOfPerspectiveCameraOrthographicCameraTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/OneOfPerspectiveCameraOrthographicCameraTypeAdapter.java deleted file mode 100644 index cac04a6..0000000 --- a/src/main/java/com/vertexvis/model/serialization/OneOfPerspectiveCameraOrthographicCameraTypeAdapter.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.*; - -import java.io.IOException; -import java.util.function.Supplier; - -public class OneOfPerspectiveCameraOrthographicCameraTypeAdapter extends TypeAdapter { - private final Supplier gsonSupplier; - public OneOfPerspectiveCameraOrthographicCameraTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, OneOfPerspectiveCameraOrthographicCamera value) - throws IOException { - if (value != null && value.getData() != null) { - out.jsonValue(gsonSupplier.get().toJson(value.getData())); - } - else { - out.jsonValue(null); - } - } - - @Override - public OneOfPerspectiveCameraOrthographicCamera read(JsonReader in) throws IOException { - Camera camera = gsonSupplier.get().fromJson(in, TypeToken.get(Camera.class).getType()); - - OneOfPerspectiveCameraOrthographicCamera oneOfCamera = null; - switch (camera.getType()) { - case "perspective": - oneOfCamera = new OneOfPerspectiveCameraOrthographicCamera( - new PerspectiveCamera() - .type(camera.getType()) - .position(camera.getPosition()) - .lookAt(camera.getLookAt()) - .up(camera.getUp()) - ); - break; - case "orthographic": - oneOfCamera = new OneOfPerspectiveCameraOrthographicCamera( - new OrthographicCamera() - .type(camera.getType()) - .viewVector(camera.getViewVector()) - .lookAt(camera.getLookAt()) - .up(camera.getUp()) - .fovHeight(camera.getFovHeight()) - ); - break; - } - return oneOfCamera; - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter.java deleted file mode 100644 index 8007328..0000000 --- a/src/main/java/com/vertexvis/model/serialization/OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.OneOfSceneViewRelationshipSceneViewStateRelationship; -import com.vertexvis.model.SceneViewRelationship; -import com.vertexvis.model.SceneViewRelationshipData; -import com.vertexvis.model.SceneViewStateRelationship; -import com.vertexvis.model.SceneViewStateRelationshipData; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -public class OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter - extends TypeAdapter { - private final Supplier gsonSupplier; - - public OneOfSceneViewRelationshipSceneViewStateRelationshipTypeAdapter( - Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, OneOfSceneViewRelationshipSceneViewStateRelationship value) - throws IOException { - out.jsonValue(gsonSupplier.get().toJson(value.getRel())); - } - - @Override - public OneOfSceneViewRelationshipSceneViewStateRelationship read(JsonReader in) - throws IOException { - String type = ""; - String id = ""; - - in.beginObject(); - while (in.hasNext()) { - switch (in.nextName()) { - case "data": - in.beginObject(); - break; - case "type": - type = in.nextString(); - break; - case "id": - id = in.nextString(); - break; - } - } - in.endObject(); - in.endObject(); - - switch (type) { - case "scene-view": - return new OneOfSceneViewRelationshipSceneViewStateRelationship(new SceneViewRelationship() - .data( - new SceneViewRelationshipData().type(SceneViewRelationshipData.TypeEnum.SCENE_VIEW) - .id(UUID.fromString(id)))); - case "scene-view-state": - return new OneOfSceneViewRelationshipSceneViewStateRelationship( - new SceneViewStateRelationship().data(new SceneViewStateRelationshipData() - .type(SceneViewStateRelationshipData.TypeEnum.SCENE_VIEW_STATE) - .id(UUID.fromString(id)))); - default: - return null; - } - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/OneOfUpdateItemToDefaultRenditionOperationTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/OneOfUpdateItemToDefaultRenditionOperationTypeAdapter.java deleted file mode 100644 index 5641e7c..0000000 --- a/src/main/java/com/vertexvis/model/serialization/OneOfUpdateItemToDefaultRenditionOperationTypeAdapter.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.*; - -import java.io.IOException; -import java.util.function.Supplier; - -public class OneOfUpdateItemToDefaultRenditionOperationTypeAdapter extends TypeAdapter { - private final Supplier gsonSupplier; - public OneOfUpdateItemToDefaultRenditionOperationTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, OneOfUpdateItemToDefaultRenditionOperation value) - throws IOException { - if (value != null && value.getData() != null) { - out.jsonValue(gsonSupplier.get().toJson(value.getData())); - } - else { - out.jsonValue(null); - } - } - - @Override - public OneOfUpdateItemToDefaultRenditionOperation read(JsonReader in) throws IOException { - TypeAdapter jsonAdapter = gsonSupplier.get().getAdapter(JsonElement.class); - TypeAdapter updateItemToDefaultRenditionOperationTypeAdapter = - gsonSupplier.get().getAdapter(TypeToken.get(UpdateItemToDefaultRenditionOperation.class)); - - JsonObject json = jsonAdapter.read(in).getAsJsonObject(); - String type = json.get("type").getAsString(); - - switch (type) { - case "update-to-default-rendition": - return new OneOfUpdateItemToDefaultRenditionOperation( - updateItemToDefaultRenditionOperationTypeAdapter.fromJsonTree(json) - ); - default: - throw new IOException("JSON deserializer not implemented for type " + type); - } - } -} diff --git a/src/main/java/com/vertexvis/model/serialization/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter.java b/src/main/java/com/vertexvis/model/serialization/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter.java deleted file mode 100644 index ed0e4d1..0000000 --- a/src/main/java/com/vertexvis/model/serialization/OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vertexvis.model.serialization; - -import com.google.gson.*; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.*; - -import java.io.IOException; -import java.util.function.Supplier; - -public class OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter extends TypeAdapter { - private Supplier gsonSupplier; - - public OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedDataTypeAdapter(Supplier gsonSupplier) { - this.gsonSupplier = gsonSupplier; - } - - @Override - public void write(JsonWriter out, OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData value) throws IOException { - TypeAdapter jsonAdapter = gsonSupplier.get().getAdapter(JsonElement.class); - TypeAdapter sceneIncludedDataTypeAdapter = gsonSupplier.get().getAdapter(TypeToken.get(WebhookEventSceneIncludedData.class)); - TypeAdapter partRevisionIncludedDataTypeAdapter = gsonSupplier.get().getAdapter(TypeToken.get(WebhookEventPartRevisionIncludedData.class)); - - if (value.getData() instanceof WebhookEventSceneIncludedData) { - jsonAdapter.write(out, sceneIncludedDataTypeAdapter.toJsonTree(value.getSceneIncludedData())); - } else if (value.getData() instanceof WebhookEventPartRevisionIncludedData) { - jsonAdapter.write(out, partRevisionIncludedDataTypeAdapter.toJsonTree(value.getPartRevisionIncludedData())); - } - } - - @Override - public OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData read(JsonReader in) throws IOException { - TypeAdapter jsonAdapter = gsonSupplier.get().getAdapter(JsonElement.class); - TypeAdapter sceneIncludedDataTypeAdapter = gsonSupplier.get().getAdapter(TypeToken.get(WebhookEventSceneIncludedData.class)); - TypeAdapter partRevisionIncludedDataTypeAdapter = gsonSupplier.get().getAdapter(TypeToken.get(WebhookEventPartRevisionIncludedData.class)); - - JsonObject json = jsonAdapter.read(in).getAsJsonObject(); - String type = json.get("type").getAsString(); - - switch (type) { - case "scene": - return new OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData(sceneIncludedDataTypeAdapter.fromJsonTree(json)); - case "part-revision": - return new OneOfWebhookEventSceneIncludedDataWebhookEventPartRevisionIncludedData(partRevisionIncludedDataTypeAdapter.fromJsonTree(json)); - default: - throw new IOException("JSON deserializer not implemented for type " + type); - } - } -} \ No newline at end of file From 724f2bf3a686233193f3b4397e9f41ef527a3164 Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Mon, 27 Jan 2025 15:00:34 -0500 Subject: [PATCH 06/10] Added updated test against the new generator --- .../java/com/vertexvis/auth/RetryingOAuthTest.java | 14 ++++++++++---- .../vertexvis/model/AnyOfCameraCameraFitTest.java | 4 ++-- ...TypeMetadataStringTypeMetadataNullTypeTest.java | 7 ++++--- ...yOfPerspectiveCameraOrthographicCameraTest.java | 4 ++-- .../AnyOfRelationshipDataApiErrorAdapterTest.java | 2 +- ...esultDataSceneItemDataPartRevisionDataTest.java | 4 ++-- ...eOfPerspectiveCameraOrthographicCameraTest.java | 4 ++-- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/test/java/com/vertexvis/auth/RetryingOAuthTest.java b/src/test/java/com/vertexvis/auth/RetryingOAuthTest.java index 5f29f49..d46770c 100644 --- a/src/test/java/com/vertexvis/auth/RetryingOAuthTest.java +++ b/src/test/java/com/vertexvis/auth/RetryingOAuthTest.java @@ -2,6 +2,8 @@ import com.vertexvis.ApiClient; import com.vertexvis.ApiException; +import com.vertexvis.ServerConfiguration; +import com.vertexvis.ServerVariable; import com.vertexvis.api.PartRevisionsApi; import okhttp3.Call; import okhttp3.Request; @@ -15,9 +17,7 @@ import java.io.IOException; import java.net.HttpURLConnection; -import java.util.HashMap; -import java.util.Objects; -import java.util.UUID; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; public class RetryingOAuthTest { @@ -38,7 +38,9 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest) throws In if (!recordedRequest.getHeaders().get("Authorization").endsWith(token)) { return new MockResponse().setResponseCode(HttpURLConnection.HTTP_UNAUTHORIZED).setBody("{\"error\": \"invalid_token\"}"); } - return new MockResponse().setBody("{\"data\": {\"id\": \"" + UUID.randomUUID().toString() + "\"}}"); + return new MockResponse().setBody("{\"data\": {\"id\": \"" + UUID.randomUUID().toString() + + "\",\"type\":\"deletePartRevisionJob\",\"attributes\":{\"status\":\"running\"," + + "\"created\":\"2020-01-01T12:00:00Z\"}}}"); } }); server.start(); @@ -52,6 +54,9 @@ public void multithreading() throws ApiException, IOException { final String baseUrl = server.url("/api").toString(); var client = new ApiClient(baseUrl, "clientid", "clientsecret", new HashMap<>()); + + client.setServers(Arrays.asList(new ServerConfiguration(server.url("/").toString(), "debug server", new HashMap()))); + var prs = new PartRevisionsApi(client); Thread[] threads = new Thread[numThreads]; for (var i = 0; i < numThreads; i++) { @@ -59,6 +64,7 @@ public void multithreading() throws ApiException, IOException { try { prs.deletePartRevision(UUID.randomUUID()); } catch (Exception e) { + System.err.println(e.toString()); numFails.incrementAndGet(); } }); diff --git a/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java b/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java index a860148..545ff9d 100644 --- a/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfCameraCameraFitTest.java @@ -14,10 +14,10 @@ public class AnyOfCameraCameraFitTest { @Test void serializesCamera() { UpdateSceneViewRequestDataAttributesCamera c = - new UpdateSceneViewRequestDataAttributesCamera(new UpdateSceneViewRequestDataAttributesCamera( + new UpdateSceneViewRequestDataAttributesCamera( new PerspectiveCamera().lookAt( new Vector3().x(new BigDecimal(2)).y(new BigDecimal(4)).z(new BigDecimal(6))) - )); + ); String expected = "{\"lookAt\":{\"x\":2,\"y\":4,\"z\":6}}"; diff --git a/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java b/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java index b80c77f..3fc1078 100644 --- a/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfMetadataLongTypeMetadataFloatTypeMetadataDateTypeMetadataStringTypeMetadataNullTypeTest.java @@ -1,5 +1,6 @@ package com.vertexvis.model; +import com.google.gson.JsonSyntaxException; import com.vertexvis.JSON; import org.junit.jupiter.api.Test; @@ -144,11 +145,11 @@ void deserializeMetadataNullType() { @Test void deserializeFails() { String json = "{\"type\":\"long\",\"value\":1234.567890}"; - assertThrows(UnsupportedOperationException.class, () -> deserializeAnyOf(json)); + assertThrows(JsonSyntaxException.class, () -> deserializeAnyOf(json)); String json2 = "{\"type\":\"date\",\"value\":1234.567890}"; - assertThrows(UnsupportedOperationException.class, () -> deserializeAnyOf(json2)); + assertThrows(JsonSyntaxException.class, () -> deserializeAnyOf(json2)); String json3 = "{\"type\":\"null\",\"value\":1234.567890}"; - assertThrows(UnsupportedOperationException.class, () -> deserializeAnyOf(json3)); + assertThrows(JsonSyntaxException.class, () -> deserializeAnyOf(json3)); } @Test diff --git a/src/test/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraTest.java b/src/test/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraTest.java index 5dfe4d1..665d238 100644 --- a/src/test/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfPerspectiveCameraOrthographicCameraTest.java @@ -31,7 +31,7 @@ void testSerializeSceneRequestWithCamera() { request = request.data(data); - String expected = "{\"data\":{\"type\":\"scene\",\"attributes\":{\"name\":\"My name\",\"treeEnabled\":true,\"worldOrientation\":{\"up\":{\"x\":1,\"y\":0,\"z\":0},\"front\":{\"x\":2,\"y\":1,\"z\":0}}}}}"; + String expected = "{\"data\":{\"type\":\"scene\",\"attributes\":{\"name\":\"My name\",\"treeEnabled\":true,\"worldOrientation\":{\"up\":{\"x\":1,\"y\":0,\"z\":0},\"front\":{\"x\":2,\"y\":1,\"z\":0}},\"metadata\":{}}}}"; assertEquals(expected, new JSON().serialize(request)); } @@ -47,7 +47,7 @@ void testingUpdateSceneRequestShouldAllowNotSpecifyingTheCamera() { ) ); - String expected = String.format("{\"data\":{\"type\":\"scene\",\"attributes\":{\"name\":\"%s\"}}}", name); + String expected = String.format("{\"data\":{\"type\":\"scene\",\"attributes\":{\"name\":\"%s\",\"metadata\":{}}}}", name); assertEquals(expected, new JSON().serialize(request)); } } diff --git a/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java b/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java index 52beb5d..7a26779 100644 --- a/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java +++ b/src/test/java/com/vertexvis/model/AnyOfRelationshipDataApiErrorAdapterTest.java @@ -47,7 +47,7 @@ void serializesApiError() { Batch batch = new Batch().vertexvisBatchResults(list); String exp = "{\"vertexvis/batch:results\":[{\"id\":\"" + id + - "\",\"status\":\"my-status\",\"code\":\"500\"}]}"; + "\",\"links\":{},\"status\":\"my-status\",\"code\":\"500\",\"meta\":{}}]}"; assertEquals(exp, new JSON().serialize(batch)); } diff --git a/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java b/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java index 2995c5c..280240a 100644 --- a/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java +++ b/src/test/java/com/vertexvis/model/OneOfHitResultDataSceneItemDataPartRevisionDataTest.java @@ -30,7 +30,7 @@ void serializesSceneItemData() { new HitIncludedInner( new SceneItemData().id(id).type("scene-item")); - String expected = "{\"type\":\"scene-item\",\"id\":\"" + id + "\"}"; + String expected = "{\"type\":\"scene-item\",\"id\":\"" + id + "\",\"links\":{}}"; assertEquals(expected, new JSON().serialize(d)); } @@ -42,7 +42,7 @@ void serializesPartRevisionData() { new HitIncludedInner( new PartRevisionData().id(id).type("part-revision")); - String expected = "{\"type\":\"part-revision\",\"id\":\"" + id + "\"}"; + String expected = "{\"type\":\"part-revision\",\"id\":\"" + id + "\",\"links\":{}}"; assertEquals(expected, new JSON().serialize(d)); } diff --git a/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java b/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java index 6301339..1db4b48 100644 --- a/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java +++ b/src/test/java/com/vertexvis/model/OneOfPerspectiveCameraOrthographicCameraTest.java @@ -56,13 +56,13 @@ void serializePerspectiveCamera() { CreateSceneViewRequestDataAttributesCamera oneOfPerspectiveCameraOrthographicCamera = new CreateSceneViewRequestDataAttributesCamera(perspectiveCamera); String expected = - "{\"camera\":{\"type\":\"perspective\",\"position\":{\"x\":3,\"y\":3,\"z\":3},\"lookAt\":{\"x\":1,\"y\":1,\"z\":1},\"up\":{\"x\":2,\"y\":2,\"z\":2}}}"; + "{\"camera\":{\"type\":\"perspective\",\"position\":{\"x\":3,\"y\":3,\"z\":3},\"lookAt\":{\"x\":1,\"y\":1,\"z\":1},\"up\":{\"x\":2,\"y\":2,\"z\":2}},\"thumbnails\":[]}"; assertEquals(expected, new JSON().serialize(new SceneViewStateDataAttributes().camera(oneOfPerspectiveCameraOrthographicCamera))); } @Test void serializeWithNoCameraShouldNotThrow() { - assertEquals("{}", new JSON().serialize(new SceneViewStateDataAttributes().created(null))); + assertEquals("{\"thumbnails\":[]}", new JSON().serialize(new SceneViewStateDataAttributes().created(null))); } } From ae7640a06ea1d02ba2f72a0af879737a8dfe7153 Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Mon, 27 Jan 2025 15:03:16 -0500 Subject: [PATCH 07/10] Updated the version to 1.0.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a389f1f..9feee58 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group = 'com.vertexvis' -version = '0.8.4' +version = '1.0.0' repositories { mavenCentral() From 7dc3b6a0fdb4c007a66f3a76303a9c02f159f9d4 Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Fri, 31 Jan 2025 17:50:24 -0500 Subject: [PATCH 08/10] Added back the examples --- scripts/generate.sh | 3 + .../com/vertexvis/example/CallbackUtil.java | 40 ++++++ .../CreateAssemblyFromRevisionsExample.java | 127 +++++++++++++++++ ...reatePartRevisionsWithMetadataExample.java | 127 +++++++++++++++++ .../example/CreatePartsAsyncExample.java | 78 +++++++++++ .../vertexvis/example/CreateSceneExample.java | 81 +++++++++++ .../java/com/vertexvis/example/JobPoller.java | 54 ++++++++ .../com/vertexvis/example/MetadataUtil.java | 55 ++++++++ .../com/vertexvis/example/PartCreator.java | 130 ++++++++++++++++++ .../com/vertexvis/example/SceneCreator.java | 85 ++++++++++++ .../example/cmdline/CommandLineOptions.java | 68 +++++++++ 11 files changed, 848 insertions(+) create mode 100644 src/main/java/com/vertexvis/example/CallbackUtil.java create mode 100644 src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java create mode 100644 src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java create mode 100644 src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java create mode 100644 src/main/java/com/vertexvis/example/CreateSceneExample.java create mode 100644 src/main/java/com/vertexvis/example/JobPoller.java create mode 100644 src/main/java/com/vertexvis/example/MetadataUtil.java create mode 100644 src/main/java/com/vertexvis/example/PartCreator.java create mode 100644 src/main/java/com/vertexvis/example/SceneCreator.java create mode 100644 src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java diff --git a/scripts/generate.sh b/scripts/generate.sh index 37b74a1..bd3ab56 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -5,12 +5,14 @@ scripts_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) source "$scripts_dir/version-lib.sh" main() { + local root=(example) local models=(MetadataDateType.java \ MetadataFloatType.java \ MetadataLongType.java \ MetadataNullType.java \ MetadataStringType.java ) mv "src/test" . || true + for f in "${root[@]}"; do mv "src/main/java/com/vertexvis/$f" . || true; done for f in "${models[@]}"; do mv "src/main/java/com/vertexvis/model/$f" . || true; done rm -rf api gradle src @@ -22,6 +24,7 @@ main() { --output /local mv ./test ./src + for f in "${root[@]}"; do mv "$f" ./src/main/java/com/vertexvis; done for f in "${models[@]}"; do mv "$f" ./src/main/java/com/vertexvis/model; done local version diff --git a/src/main/java/com/vertexvis/example/CallbackUtil.java b/src/main/java/com/vertexvis/example/CallbackUtil.java new file mode 100644 index 0000000..9ce12a9 --- /dev/null +++ b/src/main/java/com/vertexvis/example/CallbackUtil.java @@ -0,0 +1,40 @@ +package com.vertexvis.example; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiException; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +class CallbackUtil { + public static CompletableFuture execute(Consumer> callbackConsumer) { + CompletableFuture cf = new CompletableFuture<>(); + + callbackConsumer.accept(new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, + Map> responseHeaders) { + cf.completeExceptionally(e); + } + + @Override + public void onSuccess(T result, int statusCode, Map> responseHeaders) { + cf.complete(result); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + + } + }); + + return cf; + } +} diff --git a/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java b/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java new file mode 100644 index 0000000..e30afc7 --- /dev/null +++ b/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java @@ -0,0 +1,127 @@ +package com.vertexvis.example; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.api.FilesApi; +import com.vertexvis.example.cmdline.CommandLineOptions; +import com.vertexvis.model.*; +import picocli.CommandLine; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import static com.vertexvis.example.CallbackUtil.execute; + +public class CreateAssemblyFromRevisionsExample extends CommandLineOptions { + private static final Logger logger = Logger.getLogger(CreateAssemblyFromRevisionsExample.class.getName()); + + @Override + public void run() { + String clientId = getClientId(); + String secret = getClientSecret(); + if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { + throw new CommandLine.ParameterException(getSpec().commandLine(), + "Environment variables [VERTEX_CLIENT_ID] [VERTEX_CLIENT_SECRET] or command line options " + + "[--clientId]" + + "[--clientSecret]" + + "containing your Vertex client ID and secret are required." + ); + } + + ApiClient client = + new ApiClient(getVertexApiUrl(), clientId, secret, new HashMap<>()).setDebugging(isVerboseDebugLogging()); + + PartCreator pc = new PartCreator(client); + FilesApi files = new FilesApi(client); + SceneCreator sc = new SceneCreator(client); + + + List> futureParts = getPartFiles().stream() + .map(CreateAssemblyFromRevisionsExample::buildCreateFileReq) + .map(req -> createAndUploadFile(files, req) + .thenCompose(partId -> pc.createPartFromFileAsync(partId, req))) + .toList(); + + CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); + List newParts = futureParts.stream() + .map(CompletableFuture::join) + .toList(); + newParts.forEach(p -> logger.info("Created part: " + p.getData().getId() + " with name " + + p.getData().getAttributes().getName())); + + try { + Part assembly = newParts.stream() + .map(part -> part.getData().getRelationships().getPartRevisions()) + .flatMap(Collection::stream) + .map(PartDataRelationshipsPartRevisions::getId) + .peek(uuid -> logger.info(uuid.toString())) + .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) + .handle((part, ex) -> { + if (ex != null) { + if (ex.getCause() instanceof ApiException) { + logger.log(Level.SEVERE, ((ApiException) ex.getCause()).getResponseBody(), ex.getCause()); + } + logger.log(Level.SEVERE, ex.getCause().getMessage(), ex); + return null; + } else { + return part; + } + }).join(); + + logger.info("Created assembly: " + assembly.getData().getId() + " with name " + + assembly.getData().getAttributes().getName()); + var scene = sc.createSceneFromPart(assembly); + logger.info("Created scene: " + scene.getData().getId() + " with name " + + scene.getData().getAttributes().getName()); + } catch (ApiException e) { + logger.log(Level.SEVERE, "Error Code [" + e.getCode() + "], Response body " + e.getResponseBody(), e); + } catch (InterruptedException e) { + logger.severe(e.getMessage()); + // Restore interrupted state... + Thread.currentThread().interrupt(); + } + } + + public static void main(String[] args) { + + var exitCode = new CommandLine(new CreateAssemblyFromRevisionsExample()).execute(args); + System.exit(exitCode); + } + + private static CompletableFuture createAndUploadFile(FilesApi files, + CreateFileRequest req) { + return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) + .thenCompose( + md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); + } + + private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { + return execute((ApiCallback uCB) -> + files.uploadFileAsync(id, new File(name), uCB)) + .thenApply((Void) -> id); + } + + + private static CreateFileRequest buildCreateFileReq(String fileName) { + return new CreateFileRequest() + .data( + new CreateFileRequestData() + .type("file") + .attributes(new CreateFileRequestDataAttributes().name(fileName))); + } + + + private static boolean isNullOrEmpty(String s) { + return s == null || s.trim().length() == 0; + } + + +} diff --git a/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java b/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java new file mode 100644 index 0000000..3798f00 --- /dev/null +++ b/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java @@ -0,0 +1,127 @@ +package com.vertexvis.example; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.ApiException; +import com.vertexvis.api.FilesApi; +import com.vertexvis.example.cmdline.CommandLineOptions; +import com.vertexvis.model.*; +import picocli.CommandLine; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import static com.vertexvis.example.CallbackUtil.execute; + +public class CreatePartRevisionsWithMetadataExample extends CommandLineOptions { + private static final Logger logger = Logger.getLogger(CreatePartRevisionsWithMetadataExample.class.getName()); + + @Override + public void run() { + String clientId = getClientId(); + String secret = getClientSecret(); + if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { + throw new CommandLine.ParameterException(getSpec().commandLine(), + "Environment variables [VERTEX_CLIENT_ID] [VERTEX_CLIENT_SECRET] or command line options " + + "[--clientId]" + + "[--clientSecret]" + + "containing your Vertex client ID and secret are required." + ); + } + + ApiClient client = + new ApiClient(getVertexApiUrl(), clientId, secret, new HashMap<>()).setDebugging(isVerboseDebugLogging()); + + PartCreator pc = new PartCreator(client); + FilesApi files = new FilesApi(client); + SceneCreator sc = new SceneCreator(client); + + var partMetadata = MetadataUtil.createCustomMetadata(getMetadataCount()); + List> futureParts = getPartFiles().stream() + .map(CreatePartRevisionsWithMetadataExample::buildCreateFileReq) + .map(req -> createAndUploadFile(files, req) + .thenCompose(partId -> pc.createPartFromFileAsync(partId, req, partMetadata))) + .toList(); + + CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); + List newParts = futureParts.stream() + .map(CompletableFuture::join) + .toList(); + newParts.forEach(p -> logger.info("Created part: " + p.getData().getId() + " with name " + + p.getData().getAttributes().getName())); + + try { + Part assembly = newParts.stream() + .map(part -> part.getData().getRelationships().getPartRevisions()) + .flatMap(Collection::stream) + .map(PartDataRelationshipsPartRevisions::getId) + .peek(uuid -> logger.info("Part Revision Id: " + uuid)) + .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) + .handle((part, ex) -> { + if (ex != null) { + if (ex.getCause() instanceof ApiException) { + logger.log(Level.SEVERE, ((ApiException) ex.getCause()).getResponseBody(), ex.getCause()); + } + logger.log(Level.SEVERE, ex.getCause().getMessage(), ex); + return null; + } else { + return part; + } + }).join(); + + logger.info("Created assembly: " + assembly.getData().getId() + " with name " + + assembly.getData().getAttributes().getName()); + var scene = sc.createSceneFromPart(assembly); + logger.info("Created scene: " + scene.getData().getId() + " with name " + + scene.getData().getAttributes().getName()); + logger.info("Each Part Revision has: " + getMetadataCount() + " custom metadata items"); + } catch (ApiException e) { + logger.log(Level.SEVERE, "Error Code [" + e.getCode() + "], Response body " + e.getResponseBody(), e); + } catch (InterruptedException e) { + logger.severe(e.getMessage()); + // Restore interrupted state... + Thread.currentThread().interrupt(); + } + } + + public static void main(String[] args) { + + var exitCode = new CommandLine(new CreatePartRevisionsWithMetadataExample()).execute(args); + System.exit(exitCode); + } + + private static CompletableFuture createAndUploadFile(FilesApi files, + CreateFileRequest req) { + return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) + .thenCompose( + md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); + } + + private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { + return execute((ApiCallback uCB) -> + files.uploadFileAsync(id, new File(name), uCB)) + .thenApply((Void) -> id); + } + + + private static CreateFileRequest buildCreateFileReq(String fileName) { + return new CreateFileRequest() + .data( + new CreateFileRequestData() + .type("file") + .attributes(new CreateFileRequestDataAttributes().name(fileName))); + } + + + private static boolean isNullOrEmpty(String s) { + return s == null || s.trim().length() == 0; + } + +} diff --git a/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java b/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java new file mode 100644 index 0000000..f333e66 --- /dev/null +++ b/src/main/java/com/vertexvis/example/CreatePartsAsyncExample.java @@ -0,0 +1,78 @@ +package com.vertexvis.example; + +import static com.vertexvis.example.CallbackUtil.execute; + + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.api.FilesApi; +import com.vertexvis.model.CreateFileRequest; +import com.vertexvis.model.CreateFileRequestData; +import com.vertexvis.model.CreateFileRequestDataAttributes; +import com.vertexvis.model.FileMetadata; +import com.vertexvis.model.Part; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class CreatePartsAsyncExample { + public static void main(String[] args) { + String clientId = System.getenv("VERTEX_CLIENT_ID"); + String secret = System.getenv("VERTEX_CLIENT_SECRET"); + if (isNullOrEmpty(clientId) || isNullOrEmpty(secret)) { + throw new RuntimeException( + "Environment variables containing your Vertex client ID and secret are required." + ); + } + + ApiClient client = + new ApiClient("https://platform.vertexvis.com", clientId, secret, new HashMap<>()); + + PartCreator pc = new PartCreator(client); + FilesApi files = new FilesApi(client); + + List> futureParts = Stream.of("file-1.jt", "file-2.jt", "file-3.jt") + .map(CreatePartsAsyncExample::buildCreateFileReq) + .map(req -> createAndUploadFile(files, req).thenCompose(partId -> pc.createPartFromFileAsync(partId, req))) + .collect(Collectors.toList()); + + CompletableFuture.allOf(futureParts.toArray(new CompletableFuture[0])).join(); + futureParts.stream() + .map(CompletableFuture::join) + .forEach(p -> System.out.println("Created part: " + p.getData().getId() + " with name " + + p.getData().getAttributes().getName())); + + System.exit(0); + } + + private static CompletableFuture createAndUploadFile(FilesApi files, + CreateFileRequest req) { + return CallbackUtil.execute(fmdCB -> files.createFileAsync(req, fmdCB)) + .thenCompose( + md -> uploadFile(files, md.getData().getAttributes().getName(), md.getData().getId())); + } + + private static CompletableFuture uploadFile(FilesApi files, String name, UUID id) { + return execute((ApiCallback uCB) -> + files.uploadFileAsync(id, new File("/path/to/" + name), uCB)) + .thenApply((Void) -> id); + } + + private static CreateFileRequest buildCreateFileReq(String fileName) { + return new CreateFileRequest() + .data( + new CreateFileRequestData() + .type("file") + .attributes(new CreateFileRequestDataAttributes().name(fileName))); + } + + + private static boolean isNullOrEmpty(String s) { + return s == null || s.trim().length() == 0; + } +} diff --git a/src/main/java/com/vertexvis/example/CreateSceneExample.java b/src/main/java/com/vertexvis/example/CreateSceneExample.java new file mode 100644 index 0000000..1ea8a35 --- /dev/null +++ b/src/main/java/com/vertexvis/example/CreateSceneExample.java @@ -0,0 +1,81 @@ +package com.vertexvis.example; + +import com.vertexvis.ApiClient; +import com.vertexvis.api.FilesApi; +import com.vertexvis.api.StreamKeysApi; +import com.vertexvis.model.CreateFileRequest; +import com.vertexvis.model.CreateFileRequestData; +import com.vertexvis.model.CreateFileRequestDataAttributes; +import com.vertexvis.model.CreateStreamKeyRequest; +import com.vertexvis.model.CreateStreamKeyRequestData; +import com.vertexvis.model.CreateStreamKeyRequestDataAttributes; +import com.vertexvis.model.FileMetadata; +import com.vertexvis.model.Part; +import com.vertexvis.model.Scene; +import com.vertexvis.model.StreamKey; + +import java.io.File; +import java.util.HashMap; +import java.util.UUID; + +public class CreateSceneExample { + public static void main(String[] args) throws InterruptedException { + String id = System.getenv("VERTEX_CLIENT_ID"); + String secret = System.getenv("VERTEX_CLIENT_SECRET"); + if (isNullOrEmpty(id) || isNullOrEmpty(secret)) { + throw new RuntimeException( + "Environment variables containing your Vertex client ID and secret are required." + ); + } + + try { + ApiClient client = + new ApiClient("https://platform.vertexvis.com", id, secret, new HashMap<>()); + + PartCreator partCreator = new PartCreator(client); + SceneCreator sceneCreator = new SceneCreator(client); + FilesApi files = new FilesApi(client); + + FileMetadata file = files.createFile(buildCreateFileReq("my-file.jt")); + UUID fileId = file.getData().getId(); + files.uploadFile(fileId, new File("/path/to/my-file.jt")); + + Part part = partCreator.createPartFromFile(file); + Scene scene = sceneCreator.createSceneFromPart(part); + + StreamKey sceneStreamKey = + new StreamKeysApi(client).createSceneStreamKey(scene.getData().getId(), + buildCreateStreamKeyReq()); + + System.out.println( + "Use key: '" + + sceneStreamKey.getData().getAttributes().getKey() + + "' to render scene: " + + scene.getData().getId()); + } catch (RuntimeException e) { + e.printStackTrace(); + } + } + + private static CreateStreamKeyRequest buildCreateStreamKeyReq() { + int TWENTY_FOUR_HOURS = 86400; + return new CreateStreamKeyRequest() + .data( + new CreateStreamKeyRequestData() + .type("stream-key") + .attributes( + new CreateStreamKeyRequestDataAttributes().expiry(TWENTY_FOUR_HOURS))); + } + + private static CreateFileRequest buildCreateFileReq(String fileName) { + return new CreateFileRequest() + .data( + new CreateFileRequestData() + .type("file") + .attributes(new CreateFileRequestDataAttributes().name(fileName))); + } + + private static boolean isNullOrEmpty(String s) { + return s == null || s.trim().length() == 0; + } +} diff --git a/src/main/java/com/vertexvis/example/JobPoller.java b/src/main/java/com/vertexvis/example/JobPoller.java new file mode 100644 index 0000000..fda8853 --- /dev/null +++ b/src/main/java/com/vertexvis/example/JobPoller.java @@ -0,0 +1,54 @@ +package com.vertexvis.example; + +import com.vertexvis.model.QueuedJob; + +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +class JobPoller { + private static final long DEFAULT_WAIT_TIME_MS = 3000; + + private static final ScheduledExecutorService scheduler = + Executors.newScheduledThreadPool(4); + + public static CompletableFuture pollUntilJobDoneAsync(String type, + Supplier> f) { + CompletableFuture cf = new CompletableFuture<>(); + + startChecking(cf, type, f); + + return cf; + } + + public static UUID pollUntilJobDone(String type, Supplier f) + throws InterruptedException { + // Don't do this -- use a proper scheduler + Thread.sleep(DEFAULT_WAIT_TIME_MS); + + QueuedJob qj = f.get(); + + if (qj.getData().getType().equals(type)) { + return qj.getData().getId(); + } else { + return pollUntilJobDone(type, f); + } + } + + private static void startChecking(CompletableFuture resultF, String type, + Supplier> f) { + scheduler.schedule(() -> { + f.get().thenAccept(qj -> { + if (qj.getData().getType().equals(type)) { + resultF.complete(qj.getData().getId()); + } else { + startChecking(resultF, type, f); + } + }); + + }, DEFAULT_WAIT_TIME_MS, TimeUnit.MILLISECONDS); + } +} diff --git a/src/main/java/com/vertexvis/example/MetadataUtil.java b/src/main/java/com/vertexvis/example/MetadataUtil.java new file mode 100644 index 0000000..a7256ad --- /dev/null +++ b/src/main/java/com/vertexvis/example/MetadataUtil.java @@ -0,0 +1,55 @@ +package com.vertexvis.example; + +import com.vertexvis.model.*; + +import java.time.OffsetDateTime; +import java.util.AbstractMap; +import java.util.Map; +import java.util.UUID; +import java.util.random.RandomGenerator; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public class MetadataUtil { + + enum MetadataType { + LONG, + FLOAT, + DATE, + STRING, + NULL + } + + public static Map createCustomMetadata(int numberOfMetadataProperties) { + return IntStream.range(0, numberOfMetadataProperties).mapToObj(i -> { + // generate key that index of the number of metadata properties + var key = "key_0" + (i + 1) + "/" + numberOfMetadataProperties; + var random = RandomGenerator.getDefault(); + var metadataType = random.nextInt(MetadataType.values().length); + var value = switch (MetadataType.values()[metadataType]) { + case LONG -> + new UpdatePartRevisionRequestDataAttributesMetadataValue( + new MetadataLongType().type("long").value(random.nextLong())); + + case FLOAT -> + new UpdatePartRevisionRequestDataAttributesMetadataValue( + new MetadataFloatType().type("float").value(random.nextFloat())); + case DATE -> + new UpdatePartRevisionRequestDataAttributesMetadataValue( + new MetadataDateType().type("date").value(OffsetDateTime.now())); + case STRING -> + new UpdatePartRevisionRequestDataAttributesMetadataValue( + new MetadataStringType().type("string").value(UUID.randomUUID().toString())); + case NULL -> + new UpdatePartRevisionRequestDataAttributesMetadataValue( + new MetadataNullType().type("null")); + + }; + // return a map entry of key and value + return new AbstractMap.SimpleEntry<>(key, value); + + }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + } + +} diff --git a/src/main/java/com/vertexvis/example/PartCreator.java b/src/main/java/com/vertexvis/example/PartCreator.java new file mode 100644 index 0000000..4e5f163 --- /dev/null +++ b/src/main/java/com/vertexvis/example/PartCreator.java @@ -0,0 +1,130 @@ +package com.vertexvis.example; + +import com.vertexvis.ApiCallback; +import com.vertexvis.ApiClient; +import com.vertexvis.api.PartsApi; +import com.vertexvis.api.TranslationInspectionsApi; +import com.vertexvis.model.*; + +import java.math.BigDecimal; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static com.vertexvis.example.CallbackUtil.execute; + +class PartCreator { + private final TranslationInspectionsApi tiApi; + private final PartsApi parts; + + public PartCreator(ApiClient client) { + this.parts = new PartsApi(client); + this.tiApi = new TranslationInspectionsApi(client); + } + + public Part createPartFromFile(FileMetadata metadata) throws InterruptedException { + return createPartFromFile(metadata, Collections.emptyMap()); + } + + public Part createPartFromFile(FileMetadata metadata, Map partMetadata) throws InterruptedException { + Part qp = parts.createPart(getCreatePartRequest(metadata.getData().getId(), metadata.getData().getAttributes().getName(), partMetadata)); + UUID partId = + JobPoller.pollUntilJobDone("part", () -> tiApi.getQueuedTranslation(qp.getData().getId())); + return parts.getPart(partId, null); + } + + public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req) { + return createPartFromFileAsync(id, req, Collections.emptyMap()); + } + + public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req, Map metadata) { + CompletableFuture p = + execute(cb -> parts.createPartAsync(getCreatePartRequest(id, req.getData().getAttributes().getName(), metadata), cb)); + CompletableFuture partId = p.thenCompose(qj -> + JobPoller.pollUntilJobDoneAsync("part", () -> + execute(cb -> tiApi.getQueuedTranslationAsync(qj.getData().getId(), cb)))); + + return partId.thenCompose( + pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId, null, cb))); + } + + public CompletableFuture createAssemblyFromRevisions(List revisions, String name) { + CompletableFuture p = + execute(cb -> parts.createPartAsync(createPartAssemblyRequest(revisions, name), cb)); + return p.thenCompose( + pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId.getData().getId(), null, cb))); + } + + private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName) { + return getCreatePartRequest(fileId, partName, Collections.emptyMap()); + } + + private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName, Map metadata) { + FileRelationship fileRelationship = new FileRelationship() + .data( + new FileRelationshipData() + .id(fileId) + .type(FileRelationshipData.TypeEnum.FILE)); + return new CreatePartRequest() + .data( + new CreatePartRequestData() + .type("part") + .attributes( + new CreatePartRequestDataAttributes() + .suppliedId("my-part-" + UUID.randomUUID()) + .suppliedRevisionId("my-part-rev-A") + .name(partName) + .metadata(metadata)) + .relationships(new CreatePartRequestDataRelationships() + .source(new CreatePartRequestDataRelationshipsSource(fileRelationship) + ))); + } + + private static CreatePartRequest createPartAssemblyRequest(List revisionIds, String assemblyName) { + + PartAssemblyRelationship partAssemblyRelationship = new PartAssemblyRelationship() + .data(new PartAssemblyRelationshipData() + .metadata(Collections.emptyMap()) + .children(createPartRevisionInstances(revisionIds)) + ); + var uuid = UUID.randomUUID(); + return new CreatePartRequest() + .data( + new CreatePartRequestData() + .type("assembly") + .attributes(new CreatePartRequestDataAttributes() + .suppliedId("my-assembly-" + uuid) + .suppliedRevisionId("my-part-rev-" + uuid) + .name(assemblyName)) + .relationships(new CreatePartRequestDataRelationships() + .source(new CreatePartRequestDataRelationshipsSource(partAssemblyRelationship)) + )); + } + + private static List createPartRevisionInstances(List ids) { + int num = ids.size(); + return IntStream.range(0, num) + .mapToObj(ordinal -> new PartRevisionInstance(). + ordinal(ordinal) + .revisionId(ids.get(ordinal)) + .transform(new Matrix4() + .r0(createVector4(BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE)) + .r1(createVector4(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ONE)) + .r2(createVector4(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ONE)) + .r3(createVector4(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ONE)) + )) + .collect(Collectors.toList()); + } + + private static Vector4 createVector4(BigDecimal x, BigDecimal y, BigDecimal z, BigDecimal w) { + return new Vector4() + .x(x) + .y(y) + .z(z) + .w(w); + } +} diff --git a/src/main/java/com/vertexvis/example/SceneCreator.java b/src/main/java/com/vertexvis/example/SceneCreator.java new file mode 100644 index 0000000..3643a86 --- /dev/null +++ b/src/main/java/com/vertexvis/example/SceneCreator.java @@ -0,0 +1,85 @@ +package com.vertexvis.example; + +import static com.vertexvis.model.CameraFit.TypeEnum.FIT_VISIBLE_SCENE_ITEMS; + + +import com.vertexvis.ApiClient; +import com.vertexvis.api.SceneItemsApi; +import com.vertexvis.api.ScenesApi; +import com.vertexvis.model.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Optional; +import java.util.UUID; + +class SceneCreator { + private final ScenesApi scenes; + private final SceneItemsApi sceneItems; + + private static final Logger logger = LoggerFactory.getLogger(SceneCreator.class); + + public SceneCreator(ApiClient apiClient) { + this.scenes = new ScenesApi(apiClient); + this.sceneItems = new SceneItemsApi(apiClient); + } + + Scene commitSceneChanges(UUID sceneId) { + return scenes.updateScene( + sceneId, + new UpdateSceneRequest() + .data( + new UpdateSceneRequestData() + .type("scene") + .attributes( + new UpdateSceneRequestDataAttributes() + .state(UpdateSceneRequestDataAttributes.StateEnum.COMMIT) + .camera( + new UpdateSceneViewRequestDataAttributesCamera( + new CameraFit().type(FIT_VISIBLE_SCENE_ITEMS)))))); + } + + public Scene createSceneFromPart(Part p) throws InterruptedException { + return createSceneFromPart(p, true); + } + + public Scene createSceneFromPart(Part p, boolean commitChanges) throws InterruptedException { + assert p.getData().getRelationships() != null; + UUID revisionId = p.getData().getRelationships().getPartRevisions().get(0).getId(); + var name = Optional.of(p.getData().getAttributes()).map(PartDataAttributes::getName).orElse("ACube"); + Scene scene = + scenes.createScene( + new CreateSceneRequest() + .data( + new CreateSceneRequestData() + .type("scene") + .attributes(new CreateSceneRequestDataAttributes().name(name).treeEnabled(true)))); + + QueuedJob job = + sceneItems.createSceneItem( + scene.getData().getId(), + new CreateSceneItemRequest() + .data( + new CreateSceneItemRequestData() + .type("scene-item") + .attributes( + new CreateSceneItemRequestDataAttributes().suppliedId("my-part")) + .relationships( + new CreateSceneItemRequestDataRelationships() + .source( + new CreateSceneItemRequestDataRelationshipsSource( + new PartRevisionRelationship() + .data( + new PartDataRelationshipsPartRevisions() + .type( + PartDataRelationshipsPartRevisions.TypeEnum + .PART_REVISION) + .id(revisionId))))))); + + JobPoller.pollUntilJobDone( + "scene-item", () -> sceneItems.getQueuedSceneItem(job.getData().getId())); + + + return commitChanges ? commitSceneChanges(scene.getData().getId()) : scene; + } +} diff --git a/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java b/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java new file mode 100644 index 0000000..38da3bf --- /dev/null +++ b/src/main/java/com/vertexvis/example/cmdline/CommandLineOptions.java @@ -0,0 +1,68 @@ +package com.vertexvis.example.cmdline; + +import picocli.CommandLine; + +import java.util.List; +import java.util.UUID; + +@CommandLine.Command(mixinStandardHelpOptions = true) +public abstract class CommandLineOptions implements Runnable { + @CommandLine.Spec + CommandLine.Model.CommandSpec spec; + + public List getPartFiles() { + return partFiles; + } + + public String getAssemblyName() { + return assemblyName; + } + + public String getClientId() { + return clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public String getVertexApiUrl() { + return vertexApiUrl; + } + + public boolean isVerboseDebugLogging() { + return verboseDebugLogging; + } + + public CommandLine.Model.CommandSpec getSpec() { + return spec; + } + + public int getMetadataCount() { + return metadataCount; + } + + @CommandLine.Parameters(arity = "1..*", description = "Specify CAD files separated by '${sys:path.separator}'" + + " to create part revisions from.", + split = "${sys:path.separator}") + private List partFiles; + @CommandLine.Option(names = {"-n"}, description = "Name of the assembly to create from the parts") + private String assemblyName = "assembly-from-parts" + UUID.randomUUID().toString(); + + @CommandLine.Option(names = {"-i", "--clientId"}, description = "Vertex API client id", defaultValue = "${env:VERTEX_CLIENT_ID}") + private String clientId; + @CommandLine.Option(names = {"-s", "--clientSecret"}, description = "Vertex API client secret", defaultValue = "${env:VERTEX_CLIENT_SECRET}") + private String clientSecret; + + @CommandLine.Option(names = {"-e", "--env"}, description = "Vertex API endpoint. Defaults to https://platform.vertexvis.com") + private String vertexApiUrl = "https://platform.vertexvis.com"; + + @CommandLine.Option(names = {"-v", "--verbose"}, description = "Turn on debug logging") + private boolean verboseDebugLogging; + + // parameter for number of metadata to create per part + @CommandLine.Option(names = {"-m", "--metadata"}, description = "Number of metadata to create") + private int metadataCount = 0; + + +} From ed34ceff7167e0973670ccf8eee0c56b93cc936d Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Sat, 1 Feb 2025 18:40:10 -0500 Subject: [PATCH 09/10] Version update was not captured in the source` --- src/main/java/com/vertexvis/ApiClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/vertexvis/ApiClient.java b/src/main/java/com/vertexvis/ApiClient.java index 544d6ee..ae6e046 100644 --- a/src/main/java/com/vertexvis/ApiClient.java +++ b/src/main/java/com/vertexvis/ApiClient.java @@ -1,6 +1,6 @@ /* * Vertex Platform API - * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. * * The version of the OpenAPI document: 1.0 * Contact: support@vertexvis.com @@ -222,7 +222,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("vertex-api-client-java/0.8.4"); + setUserAgent("vertex-api-client-java/1.0.0"); authentications = new HashMap(); } @@ -1534,10 +1534,10 @@ public String guessContentTypeFromFile(File file) { /** * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. * - * @param mpBuilder MultipartBody.Builder + * @param mpBuilder MultipartBody.Builder * @param key The key of the Header element * @param file The file to add to the Header - */ + */ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); From 10ff48751c5591ac083ee84d7340980adfd3230b Mon Sep 17 00:00:00 2001 From: Anders Sjoblom Date: Wed, 12 Feb 2025 16:38:09 -0500 Subject: [PATCH 10/10] Updated some examples to reflect the latest change proposal. --- .openapi-generator/FILES | 7 +- api/openapi.yaml | 695 +++++++++++------- scripts/generate.sh | 3 + src/main/java/com/vertexvis/JSON.java | 7 +- src/main/java/com/vertexvis/api/PartsApi.java | 29 +- .../java/com/vertexvis/api/SceneItemsApi.java | 17 +- .../com/vertexvis/auth/RetryingOAuth.java | 319 ++++---- .../CreateAssemblyFromRevisionsExample.java | 3 +- ...reatePartRevisionsWithMetadataExample.java | 2 +- .../java/com/vertexvis/example/JobPoller.java | 38 +- .../com/vertexvis/example/MetadataUtil.java | 12 +- .../com/vertexvis/example/PartCreator.java | 20 +- .../com/vertexvis/example/SceneCreator.java | 55 +- .../model/CreatePart200Response.java | 282 +++++++ .../CreatePartRequestDataAttributes.java | 12 +- ...artRequestDataAttributesMetadataValue.java | 405 ++++++++++ .../CreateSceneItemRequestDataAttributes.java | 12 +- .../model/GetQueuedSceneItem200Response.java | 279 +++++++ .../com/vertexvis/model/ModelViewData.java | 12 +- ...Type.java => ModelViewDataAttributes.java} | 141 +--- .../model/PartAssemblyRelationshipData.java | 12 +- .../model/PartDataRelationships.java | 14 +- ...tDataRelationshipsPartRevisionsInner.java} | 56 +- .../model/PartRevisionDataAttributes.java | 12 +- .../model/PartRevisionRelationship.java | 12 +- .../vertexvis/model/PmiAnnotationData.java | 12 +- .../model/PropertyEntryDataAttributes.java | 14 +- .../model/SceneItemDataAttributes.java | 12 +- ...ionRequestDataAttributesMetadataValue.java | 65 +- .../UpdateSceneItemRequestDataAttributes.java | 12 +- ...eneItemRequestDataRelationshipsSource.java | 2 +- .../UpdateSceneRequestDataAttributes.java | 12 - 32 files changed, 1775 insertions(+), 810 deletions(-) create mode 100644 src/main/java/com/vertexvis/model/CreatePart200Response.java create mode 100644 src/main/java/com/vertexvis/model/CreatePartRequestDataAttributesMetadataValue.java create mode 100644 src/main/java/com/vertexvis/model/GetQueuedSceneItem200Response.java rename src/main/java/com/vertexvis/model/{PropertyKeyType.java => ModelViewDataAttributes.java} (58%) rename src/main/java/com/vertexvis/model/{PartDataRelationshipsPartRevisions.java => PartDataRelationshipsPartRevisionsInner.java} (80%) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 6a183db..753f41e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -108,12 +108,14 @@ src/main/java/com/vertexvis/model/CreateGeometrySetRequestDataRelationships.java src/main/java/com/vertexvis/model/CreateHitRequest.java src/main/java/com/vertexvis/model/CreateHitRequestData.java src/main/java/com/vertexvis/model/CreateHitRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreatePart200Response.java src/main/java/com/vertexvis/model/CreatePartRenditionRequest.java src/main/java/com/vertexvis/model/CreatePartRenditionRequestData.java src/main/java/com/vertexvis/model/CreatePartRenditionRequestDataAttributes.java src/main/java/com/vertexvis/model/CreatePartRequest.java src/main/java/com/vertexvis/model/CreatePartRequestData.java src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java +src/main/java/com/vertexvis/model/CreatePartRequestDataAttributesMetadataValue.java src/main/java/com/vertexvis/model/CreatePartRequestDataRelationships.java src/main/java/com/vertexvis/model/CreatePartRequestDataRelationshipsSource.java src/main/java/com/vertexvis/model/CreateSceneAlterationRequest.java @@ -187,6 +189,7 @@ src/main/java/com/vertexvis/model/GeometrySetData.java src/main/java/com/vertexvis/model/GeometrySetList.java src/main/java/com/vertexvis/model/GeometrySetRelationship.java src/main/java/com/vertexvis/model/GeometrySetRelationshipData.java +src/main/java/com/vertexvis/model/GetQueuedSceneItem200Response.java src/main/java/com/vertexvis/model/Hit.java src/main/java/com/vertexvis/model/HitData.java src/main/java/com/vertexvis/model/HitDataAttributes.java @@ -206,6 +209,7 @@ src/main/java/com/vertexvis/model/MetadataNullType.java src/main/java/com/vertexvis/model/MetadataStringType.java src/main/java/com/vertexvis/model/ModelView.java src/main/java/com/vertexvis/model/ModelViewData.java +src/main/java/com/vertexvis/model/ModelViewDataAttributes.java src/main/java/com/vertexvis/model/ModelViewDataRelationships.java src/main/java/com/vertexvis/model/ModelViewList.java src/main/java/com/vertexvis/model/OAuth2BadRequest.java @@ -218,7 +222,7 @@ src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java src/main/java/com/vertexvis/model/PartData.java src/main/java/com/vertexvis/model/PartDataAttributes.java src/main/java/com/vertexvis/model/PartDataRelationships.java -src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java +src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisionsInner.java src/main/java/com/vertexvis/model/PartInstanceRelationship.java src/main/java/com/vertexvis/model/PartInstanceRelationshipData.java src/main/java/com/vertexvis/model/PartList.java @@ -252,7 +256,6 @@ src/main/java/com/vertexvis/model/PropertyEntryData.java src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java src/main/java/com/vertexvis/model/PropertyEntryDataAttributesValue.java src/main/java/com/vertexvis/model/PropertyEntryList.java -src/main/java/com/vertexvis/model/PropertyKeyType.java src/main/java/com/vertexvis/model/PropertyLongType.java src/main/java/com/vertexvis/model/PropertySetRelationship.java src/main/java/com/vertexvis/model/PropertySetRelationshipData.java diff --git a/api/openapi.yaml b/api/openapi.yaml index 480a573..e2f537c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -2792,21 +2792,12 @@ paths: $ref: '#/components/schemas/CreatePartRequest' required: true responses: - "201": + "200": content: application/vnd.api+json: schema: - $ref: '#/components/schemas/Part' + $ref: '#/components/schemas/createPart_200_response' description: Created Part - "202": - content: - application/vnd.api+json: - schema: - $ref: '#/components/schemas/QueuedJob' - description: Accepted - headers: - content-location: - $ref: '#/components/headers/ContentLocation' "400": content: application/vnd.api+json: @@ -4357,8 +4348,7 @@ paths: minimum: 1 type: integer style: form - - allowEmptyValue: true - description: Source ID to filter on. + - description: Source ID to filter on. explode: true in: query name: "filter[source]" @@ -4366,7 +4356,6 @@ paths: schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 maxLength: 1024 - nullable: true type: string style: form - description: Comma-separated list of supplied IDs to filter on. @@ -4554,7 +4543,7 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/QueuedJob' + $ref: '#/components/schemas/getQueuedSceneItem_200_response' description: OK "301": description: Moved Permanently @@ -7594,7 +7583,7 @@ paths: queued-export.completed: '{$request.body#/data/attributes/url}': post: - operationId: queued_export_completed_Post + operationId: queuedExportCompletedPost requestBody: content: application/json: @@ -7607,7 +7596,7 @@ paths: queued-scene-item.completed: '{$request.body#/data/attributes/url}': post: - operationId: queued_scene_item_completed_Post + operationId: queuedSceneItemCompletedPost requestBody: content: application/json: @@ -7620,7 +7609,7 @@ paths: queued-translation.completed: '{$request.body#/data/attributes/url}': post: - operationId: queued_translation_completed_Post + operationId: queuedTranslationCompletedPost requestBody: content: application/json: @@ -7633,7 +7622,7 @@ paths: scene.created: '{$request.body#/data/attributes/url}': post: - operationId: scene_created_Post + operationId: sceneCreatedPost requestBody: content: application/json: @@ -7646,7 +7635,7 @@ paths: scene.deleted: '{$request.body#/data/attributes/url}': post: - operationId: scene_deleted_Post + operationId: sceneDeletedPost requestBody: content: application/json: @@ -7659,7 +7648,7 @@ paths: scene.updated: '{$request.body#/data/attributes/url}': post: - operationId: scene_updated_Post + operationId: sceneUpdatedPost requestBody: content: application/json: @@ -8381,7 +8370,6 @@ components: $ref: '#/components/schemas/Uuid' style: simple SourceFilter: - allowEmptyValue: true description: Source ID to filter on. explode: true in: query @@ -8390,7 +8378,6 @@ components: schema: example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 maxLength: 1024 - nullable: true type: string style: form StatusFilter: @@ -8439,20 +8426,6 @@ components: maxLength: 36 type: string style: form - PropertyEntriesCategoryFilter: - description: The key categories to filter by - explode: true - in: query - name: "filter[key.category]" - required: false - schema: - description: The key category - enum: - - vendor - - vertex - - user - type: string - style: form SuppliedIdFilter: description: Comma-separated list of supplied IDs to filter on. explode: true @@ -9138,6 +9111,22 @@ components: required: - data type: object + QueuedTranslationJob: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/QueuedTranslationJobData' + included: + items: + $ref: '#/components/schemas/QueuedTranslationJob_included_inner' + type: array + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - data + type: object ModelView: additionalProperties: false properties: @@ -9666,22 +9655,6 @@ components: - data - links type: object - QueuedTranslationJob: - additionalProperties: false - properties: - data: - $ref: '#/components/schemas/QueuedTranslationJobData' - included: - items: - $ref: '#/components/schemas/QueuedTranslationJob_included_inner' - type: array - links: - additionalProperties: - $ref: '#/components/schemas/Link' - type: object - required: - - data - type: object CreateExportRequest: additionalProperties: false properties: @@ -9769,8 +9742,22 @@ components: key: href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 included: - - "" - - "" + - attributes: + metadata: + key: metadata + links: + key: + href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 + id: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + type: scene + - attributes: + metadata: + key: metadata + links: + key: + href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 + id: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + type: scene properties: data: $ref: '#/components/schemas/WebhookEventData' @@ -10158,6 +10145,8 @@ components: properties: type: description: Type of metadata value. + enum: + - long example: long maxLength: 32 type: string @@ -10173,6 +10162,8 @@ components: properties: type: description: Type of metadata value. + enum: + - float example: float maxLength: 32 type: string @@ -10188,6 +10179,8 @@ components: properties: type: description: Type of metadata value. + enum: + - date example: date maxLength: 32 type: string @@ -10204,6 +10197,8 @@ components: properties: type: description: Type of metadata value. + enum: + - string example: string maxLength: 32 type: string @@ -10219,7 +10214,9 @@ components: properties: type: description: Type of metadata value. - example: "null" + enum: + - null-type + example: null-type maxLength: 32 type: string required: @@ -10290,6 +10287,33 @@ components: required: - data type: object + QueuedTranslationJobData: + additionalProperties: false + properties: + type: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + id: + description: ID of the resource. + example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + format: uuid + maxLength: 36 + type: string + attributes: + $ref: '#/components/schemas/QueuedTranslationJobData_attributes' + relationships: + $ref: '#/components/schemas/QueuedTranslationJobData_relationships' + links: + additionalProperties: + $ref: '#/components/schemas/Link' + type: object + required: + - attributes + - id + - type + type: object ModelViewData: additionalProperties: false properties: @@ -10303,7 +10327,7 @@ components: maxLength: 36 type: string attributes: - $ref: '#/components/schemas/CreateAccountRequest_data_attributes' + $ref: '#/components/schemas/ModelViewData_attributes' relationships: $ref: '#/components/schemas/ModelViewData_relationships' links: @@ -10329,7 +10353,7 @@ components: maxLength: 36 type: string attributes: - $ref: '#/components/schemas/CreateAccountRequest_data_attributes' + $ref: '#/components/schemas/ModelViewData_attributes' links: additionalProperties: $ref: '#/components/schemas/Link' @@ -10440,7 +10464,7 @@ components: description: Relationship to a `part-revision`. properties: data: - $ref: '#/components/schemas/PartData_relationships_partRevisions' + $ref: '#/components/schemas/PartData_relationships_partRevisions_inner' required: - data type: object @@ -11095,33 +11119,6 @@ components: FilterLiteral: description: A value of a filter. type: string - QueuedTranslationJobData: - additionalProperties: false - properties: - type: - example: some-string - maxLength: 1024 - minLength: 1 - type: string - id: - description: ID of the resource. - example: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 - format: uuid - maxLength: 36 - type: string - attributes: - $ref: '#/components/schemas/QueuedTranslationJobData_attributes' - relationships: - $ref: '#/components/schemas/QueuedTranslationJobData_relationships' - links: - additionalProperties: - $ref: '#/components/schemas/Link' - type: object - required: - - attributes - - id - - type - type: object CADExportConfig: allOf: - $ref: '#/components/schemas/ExportConfig' @@ -11244,6 +11241,15 @@ components: - type type: object WebhookEventSceneIncludedData: + example: + attributes: + metadata: + key: metadata + links: + key: + href: /some-resource/d98d621a-23da-49fe-af96-6be709abb718 + id: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 + type: scene properties: type: example: scene @@ -11387,24 +11393,6 @@ components: required: - ordinal type: object - PropertyKeyType: - properties: - category: - description: The key category - enum: - - vendor - - vertex - - user - type: string - name: - example: some-string - maxLength: 1024 - minLength: 1 - type: string - required: - - category - - name - type: object QueryById: additionalProperties: false properties: @@ -11898,6 +11886,9 @@ components: - resource type: object WebhookEventSceneIncludedAttributes: + example: + metadata: + key: metadata properties: metadata: additionalProperties: @@ -11948,6 +11939,14 @@ components: required: - related type: object + createPart_200_response: + oneOf: + - $ref: '#/components/schemas/Part' + - $ref: '#/components/schemas/QueuedTranslationJob' + getQueuedSceneItem_200_response: + oneOf: + - $ref: '#/components/schemas/QueuedJob' + - $ref: '#/components/schemas/SceneItem' CreateAccountRequest_data_attributes: properties: name: @@ -11959,6 +11958,7 @@ components: - name type: object CreateAccountRequest_data: + additionalProperties: false properties: type: example: some-string @@ -11972,6 +11972,7 @@ components: - type type: object Account_data_attributes: + additionalProperties: false properties: name: example: some-string @@ -11990,6 +11991,7 @@ components: - name type: object Account_data: + additionalProperties: false properties: type: example: account @@ -12028,6 +12030,7 @@ components: type: string type: object UpdateAccountRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12059,6 +12062,7 @@ components: - name type: object AdminCreateApplicationRequest_data: + additionalProperties: false properties: type: example: some-string @@ -12072,6 +12076,7 @@ components: - type type: object CreatedApplication_data_attributes: + additionalProperties: false properties: name: example: some-string @@ -12109,6 +12114,7 @@ components: - secret type: object CreatedApplication_data: + additionalProperties: false properties: type: example: application @@ -12139,6 +12145,7 @@ components: type: array type: object UpdateApplicationRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12151,6 +12158,10 @@ components: - attributes - type type: object + Batch_vertexvis_batch_results_inner: + anyOf: + - $ref: '#/components/schemas/RelationshipData' + - $ref: '#/components/schemas/ApiError' CreateFileRequest_data_attributes: properties: name: @@ -12182,6 +12193,7 @@ components: - name type: object CreateFileRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12205,6 +12217,7 @@ components: type: integer type: object UpdateFileRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12218,6 +12231,7 @@ components: - type type: object CreateGeometrySetRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/FileRelationship' @@ -12225,6 +12239,7 @@ components: - source type: object CreateGeometrySetRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12248,6 +12263,7 @@ components: - viewport type: object CreateHitRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12261,6 +12277,7 @@ components: - type type: object Hit_data_attributes: + additionalProperties: false properties: created: example: 2020-01-01T12:00:00Z @@ -12270,6 +12287,7 @@ components: - created type: object Hit_data_relationships: + additionalProperties: false properties: results: items: @@ -12279,6 +12297,7 @@ components: - results type: object Hit_data: + additionalProperties: false properties: type: example: hit @@ -12299,6 +12318,11 @@ components: - relationships - type type: object + Hit_included_inner: + oneOf: + - $ref: '#/components/schemas/HitResultData' + - $ref: '#/components/schemas/SceneItemData' + - $ref: '#/components/schemas/PartRevisionData' RevokeOAuth2TokenRequest_data_attributes: properties: token: @@ -12310,6 +12334,7 @@ components: - token type: object RevokeOAuth2TokenRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12333,6 +12358,7 @@ components: - subject type: object AdminLoginAcceptRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12351,6 +12377,7 @@ components: - session type: object AdminConsentAcceptRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12361,6 +12388,13 @@ components: - attributes - type type: object + UpdatePartRevisionRequest_data_attributes_metadata_value: + oneOf: + - $ref: '#/components/schemas/MetadataLongType' + - $ref: '#/components/schemas/MetadataFloatType' + - $ref: '#/components/schemas/MetadataDateType' + - $ref: '#/components/schemas/MetadataStringType' + - $ref: '#/components/schemas/MetadataNullType' UpdatePartRevisionRequest_data_attributes: properties: metadata: @@ -12400,6 +12434,7 @@ components: type: string type: object UpdatePartRevisionRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/FileRelationship' @@ -12407,6 +12442,7 @@ components: $ref: '#/components/schemas/PartRenditionRelationship' type: object UpdatePartRevisionRequest_data: + additionalProperties: false description: | Modify existing part revisions using this endpoint. When specifying a `relationship`, the generated output from that relationship will be used to replace any relationship that is present on the revision prior to the update. For example, sending a file relationship that has geometry will replace the existing geometry on the revision with the new geometry in the given file. @@ -12450,6 +12486,7 @@ components: type: boolean type: object CreatePartRenditionRequest_data: + additionalProperties: false description: | Create a new part rendition. @@ -12476,6 +12513,13 @@ components: - attributes - type type: object + CreatePartRequest_data_attributes_metadata_value: + anyOf: + - $ref: '#/components/schemas/MetadataLongType' + - $ref: '#/components/schemas/MetadataFloatType' + - $ref: '#/components/schemas/MetadataDateType' + - $ref: '#/components/schemas/MetadataStringType' + - $ref: '#/components/schemas/MetadataNullType' CreatePartRequest_data_attributes: properties: suppliedId: @@ -12509,7 +12553,7 @@ components: type: boolean metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' description: | Additional metadata about the `part` and/or `part-revision`. This metadata will take precedence over any metadata that belongs to the part file if `indexMetadata` is specified. type: object @@ -12539,7 +12583,12 @@ components: maxLength: 255 type: string type: object + CreatePartRequest_data_relationships_source: + anyOf: + - $ref: '#/components/schemas/FileRelationship' + - $ref: '#/components/schemas/PartAssemblyRelationship' CreatePartRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/CreatePartRequest_data_relationships_source' @@ -12547,6 +12596,7 @@ components: - source type: object CreatePartRequest_data: + additionalProperties: false properties: type: description: Resource object type. Specify one and only one of suppliedId @@ -12562,6 +12612,20 @@ components: - attributes - type type: object + QueuedTranslationJob_included_inner: + anyOf: + - $ref: '#/components/schemas/GeometrySetData' + - $ref: '#/components/schemas/PartRevisionData' + - $ref: '#/components/schemas/PartRenditionData' + UpsertPropertyEntriesRequest_data_attributes_entries_value: + anyOf: + - $ref: '#/components/schemas/PropertyStringType' + - $ref: '#/components/schemas/PropertyDoubleType' + - $ref: '#/components/schemas/PropertyLongType' + - $ref: '#/components/schemas/PropertyDateType' + - nullable: true + type: object + nullable: true UpsertPropertyEntriesRequest_data_attributes: properties: entries: @@ -12573,7 +12637,16 @@ components: required: - entries type: object + UpsertPropertyEntriesRequest_data_relationships_propertySet: + anyOf: + - $ref: '#/components/schemas/PropertySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneItemRelationship' + - $ref: '#/components/schemas/PartInstanceRelationship' + description: "Relationship to the property set by `property-set`, `part-revision`,\ + \ `part-instance` or `scene-item`." UpsertPropertyEntriesRequest_data_relationships: + additionalProperties: false properties: propertySet: $ref: '#/components/schemas/UpsertPropertyEntriesRequest_data_relationships_propertySet' @@ -12581,6 +12654,7 @@ components: - propertySet type: object UpsertPropertyEntriesRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12608,6 +12682,7 @@ components: - alterations type: object CreateSceneAlterationRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12642,6 +12717,7 @@ components: type: boolean type: object UpdateSceneItemOverrideRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12681,6 +12757,7 @@ components: type: boolean type: object CreateSceneItemOverrideRequest_data_relationships: + additionalProperties: false properties: sceneItem: $ref: '#/components/schemas/SceneItemRelationship' @@ -12688,6 +12765,7 @@ components: - sceneItem type: object CreateSceneItemOverrideRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12726,7 +12804,7 @@ components: type: string metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' description: | Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. type: object @@ -12737,12 +12815,19 @@ components: description: Whether this item is an end item. type: boolean type: object + UpdateSceneItemRequest_data_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + description: Relationship to a `geometry-set` or `part-revision`. UpdateSceneItemRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/UpdateSceneItemRequest_data_relationships_source' type: object UpdateSceneItemRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12757,6 +12842,11 @@ components: - attributes - type type: object + UpdateSceneViewRequest_data_attributes_camera: + anyOf: + - $ref: '#/components/schemas/PerspectiveCamera' + - $ref: '#/components/schemas/OrthographicCamera' + - $ref: '#/components/schemas/CameraFit' UpdateSceneViewRequest_data_attributes: properties: camera: @@ -12769,6 +12859,7 @@ components: type: boolean type: object UpdateSceneViewRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12781,6 +12872,10 @@ components: - attributes - type type: object + CreateSceneViewRequest_data_attributes_camera: + oneOf: + - $ref: '#/components/schemas/PerspectiveCamera' + - $ref: '#/components/schemas/OrthographicCamera' CreateSceneViewRequest_data_attributes: properties: camera: @@ -12793,11 +12888,13 @@ components: type: boolean type: object CreateSceneViewRequest_data_relationships: + additionalProperties: false properties: sceneViewState: $ref: '#/components/schemas/SceneViewStateRelationship' type: object CreateSceneViewRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12842,6 +12939,7 @@ components: type: object type: object CreateSceneRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/SceneRelationship' @@ -12849,6 +12947,7 @@ components: - source type: object CreateSceneRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12880,7 +12979,6 @@ components: \ a PLM system." example: PN12345 maxLength: 1024 - nullable: true type: string name: example: some-string @@ -12902,6 +13000,7 @@ components: type: object type: object UpdateSceneRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12928,7 +13027,12 @@ components: maxLength: 1024 type: string type: object + CreateSceneViewStateRequest_data_relationships_source: + oneOf: + - $ref: '#/components/schemas/SceneViewRelationship' + - $ref: '#/components/schemas/SceneViewStateRelationship' CreateSceneViewStateRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/CreateSceneViewStateRequest_data_relationships_source' @@ -12936,6 +13040,7 @@ components: - source type: object CreateSceneViewStateRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12952,6 +13057,7 @@ components: - type type: object UpdateSceneViewStateRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12979,6 +13085,7 @@ components: type: boolean type: object CreateStreamKeyRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -12992,6 +13099,7 @@ components: - type type: object CreateSceneAnnotationSetRequest_data_attributes: + additionalProperties: false properties: name: example: some-string @@ -13005,6 +13113,7 @@ components: type: string type: object CreateSceneAnnotationSetRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13017,7 +13126,18 @@ components: - attributes - type type: object + CreateSceneAnnotationRequest_data_attributes_data: + description: The data describing how to render this annotation. + discriminator: + mapping: + callout: '#/components/schemas/SceneAnnotationCalloutDataType' + custom: '#/components/schemas/SceneAnnotationCustomDataType' + propertyName: type + oneOf: + - $ref: '#/components/schemas/SceneAnnotationCalloutDataType' + - $ref: '#/components/schemas/SceneAnnotationCustomDataType' CreateSceneAnnotationRequest_data_attributes: + additionalProperties: false properties: data: $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes_data' @@ -13030,6 +13150,7 @@ components: - data type: object CreateSceneAnnotationRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13043,6 +13164,7 @@ components: - type type: object UpdateSceneAnnotationRequest_data_attributes: + additionalProperties: false properties: data: $ref: '#/components/schemas/CreateSceneAnnotationRequest_data_attributes_data' @@ -13054,6 +13176,7 @@ components: type: string type: object UpdateSceneAnnotationRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13066,7 +13189,15 @@ components: - attributes - type type: object + CreateSceneSyncRequest_operation: + discriminator: + mapping: + update-to-default-rendition: '#/components/schemas/UpdateItemToDefaultRenditionOperation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/UpdateItemToDefaultRenditionOperation' CreateTranslationInspectionRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13080,6 +13211,7 @@ components: - type type: object TranslationInspectionJob_data_attributes: + additionalProperties: false properties: status: example: running @@ -13093,6 +13225,7 @@ components: - status type: object TranslationInspectionJob_data: + additionalProperties: false properties: type: example: translation-inspection @@ -13110,6 +13243,16 @@ components: - id - type type: object + CreateExportRequest_data_attributes_config: + description: Specifies the export format and options to configure the export. + discriminator: + mapping: + jt: '#/components/schemas/CADExportConfig' + step: '#/components/schemas/CADExportConfig' + x_t: '#/components/schemas/CADExportConfig' + propertyName: format + oneOf: + - $ref: '#/components/schemas/CADExportConfig' CreateExportRequest_data_attributes: properties: config: @@ -13123,6 +13266,7 @@ components: - config type: object CreateExportRequest_data_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/ExportRelationship' @@ -13132,6 +13276,7 @@ components: - source type: object CreateExportRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13163,6 +13308,7 @@ components: - url type: object CreateWebhookSubscriptionRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13175,6 +13321,15 @@ components: - attributes - type type: object + WebhookEvent_included_inner: + discriminator: + mapping: + scene: '#/components/schemas/WebhookEventSceneIncludedData' + part-revision: '#/components/schemas/WebhookEventPartRevisionIncludedData' + propertyName: type + oneOf: + - $ref: '#/components/schemas/WebhookEventSceneIncludedData' + - $ref: '#/components/schemas/WebhookEventPartRevisionIncludedData' UpdateWebhookSubscriptionRequest_data_attributes: properties: status: @@ -13195,6 +13350,7 @@ components: type: string type: object UpdateWebhookSubscriptionRequest_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13208,6 +13364,7 @@ components: - type type: object ApiError_source: + additionalProperties: false properties: pointer: example: /body/data/attributes @@ -13217,6 +13374,7 @@ components: type: string type: object ApplicationData_attributes: + additionalProperties: false properties: name: example: some-string @@ -13248,6 +13406,7 @@ components: - scopes type: object BatchOperation_ref: + additionalProperties: false description: Target of batch operation. properties: type: @@ -13287,6 +13446,7 @@ components: - status type: object FileMetadataData_attributes: + additionalProperties: false properties: name: example: some-string @@ -13323,6 +13483,7 @@ components: - status type: object FileRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13352,6 +13513,7 @@ components: - point type: object HitResultData_relationships: + additionalProperties: false properties: sceneItem: $ref: '#/components/schemas/RelationshipData' @@ -13359,6 +13521,7 @@ components: - sceneItem type: object SceneItemData_attributes: + additionalProperties: false properties: boundingBox: $ref: '#/components/schemas/BoundingBox' @@ -13372,7 +13535,7 @@ components: $ref: '#/components/schemas/ColorMaterial' metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' type: object name: example: some-string @@ -13394,7 +13557,14 @@ components: worldTransform: $ref: '#/components/schemas/Matrix4' type: object + SceneItemData_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneRelationship' + - $ref: '#/components/schemas/PartRenditionRelationship' SceneItemData_relationships: + additionalProperties: false properties: source: $ref: '#/components/schemas/SceneItemData_relationships_source' @@ -13404,6 +13574,7 @@ components: $ref: '#/components/schemas/PartRenditionRelationship' type: object PartRevisionData_attributes: + additionalProperties: false properties: created: example: 2020-01-01T12:00:00Z @@ -13411,7 +13582,7 @@ components: type: string metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' type: object suppliedId: example: some-string @@ -13430,6 +13601,7 @@ components: type: string type: object PartRevisionData_relationships: + additionalProperties: false properties: geometrySet: $ref: '#/components/schemas/GeometrySetRelationshipData' @@ -13439,6 +13611,7 @@ components: $ref: '#/components/schemas/PartRenditionRelationship' type: object PartRenditionData_attributes: + additionalProperties: false properties: created: example: 2020-01-01T12:00:00Z @@ -13456,6 +13629,7 @@ components: type: string type: object PartRenditionData_relationships: + additionalProperties: false properties: geometrySet: $ref: '#/components/schemas/GeometrySetRelationshipData' @@ -13463,6 +13637,7 @@ components: $ref: '#/components/schemas/PartRevisionRelationship' type: object PartRenditionRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13482,6 +13657,7 @@ components: - type type: object PartRevisionInstanceData_attributes: + additionalProperties: false properties: ordinal: description: A 0-based index used for defining a consistent ordering for @@ -13492,6 +13668,7 @@ components: $ref: '#/components/schemas/Matrix4' type: object PartRevisionInstanceData_relationships: + additionalProperties: false description: This is the relationship from the instance to the parent revision properties: partRevision: @@ -13500,6 +13677,7 @@ components: - partRevision type: object PartData_attributes: + additionalProperties: false properties: name: example: some-string @@ -13520,7 +13698,8 @@ components: - name - suppliedId type: object - PartData_relationships_partRevisions: + PartData_relationships_partRevisions_inner: + additionalProperties: false properties: type: description: Resource object type. @@ -13540,15 +13719,17 @@ components: - type type: object PartData_relationships: + additionalProperties: false properties: partRevisions: items: - $ref: '#/components/schemas/PartData_relationships_partRevisions' + $ref: '#/components/schemas/PartData_relationships_partRevisions_inner' type: array required: - partRevisions type: object PartAssemblyRelationship_data: + additionalProperties: false properties: children: items: @@ -13556,31 +13737,87 @@ components: type: array metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' description: | Additional metadata about the `part` and/or `part-revision`. type: object required: - children type: object + QueuedTranslationJobData_attributes: + properties: + status: + example: running + type: string + created: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + completed: + example: 2020-01-01T12:00:00Z + format: date-time + type: string + errors: + items: + $ref: '#/components/schemas/ApiError' + maxItems: 20 + type: array + uniqueItems: true + required: + - created + - status + type: object + QueuedTranslationJobData_relationships: + additionalProperties: false + properties: + geometrySet: + $ref: '#/components/schemas/GeometrySetRelationship' + partRevision: + $ref: '#/components/schemas/PartRevisionRelationship' + partRendition: + $ref: '#/components/schemas/PartRenditionRelationship' + type: object + ModelViewData_attributes: + additionalProperties: false + properties: + name: + example: some-string + maxLength: 1024 + minLength: 1 + type: string + required: + - name + type: object ModelViewData_relationships: + additionalProperties: false properties: partRevision: $ref: '#/components/schemas/PartRevisionRelationship' required: - partRevision type: object + PropertyEntryData_attributes_value: + anyOf: + - $ref: '#/components/schemas/PropertyStringType' + - $ref: '#/components/schemas/PropertyDoubleType' + - $ref: '#/components/schemas/PropertyLongType' + - $ref: '#/components/schemas/PropertyDateType' PropertyEntryData_attributes: + additionalProperties: false properties: value: $ref: '#/components/schemas/PropertyEntryData_attributes_value' key: - $ref: '#/components/schemas/PropertyKeyType' + example: some-string + maxLength: 1024 + minLength: 1 + type: string required: - key - value type: object PropertySetRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13600,6 +13837,7 @@ components: - type type: object SceneItemRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13619,6 +13857,7 @@ components: - type type: object PartInstanceRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13638,13 +13877,38 @@ components: - type type: object SceneAlterationData_relationships: + additionalProperties: false properties: sceneView: $ref: '#/components/schemas/SceneViewRelationship' required: - sceneView type: object + SceneOperation_query: + anyOf: + - $ref: '#/components/schemas/QueryById' + - $ref: '#/components/schemas/QueryByCollection' + - $ref: '#/components/schemas/QueryAll' + description: Query `scene-items`. Use `query-by-collection` to combine multiple + queries. + SceneOperation_operations_inner: + anyOf: + - $ref: '#/components/schemas/ChangeVisibilityOp' + - $ref: '#/components/schemas/ChangeMaterialOp' + - $ref: '#/components/schemas/ClearMaterialOp' + - $ref: '#/components/schemas/ChangeTransformOp' + - $ref: '#/components/schemas/ClearTransformOp' + - $ref: '#/components/schemas/SelectOp' + - $ref: '#/components/schemas/DeselectOperation' + - $ref: '#/components/schemas/ClearRenOp' + - $ref: '#/components/schemas/ViewDefaultRenOp' + - $ref: '#/components/schemas/ViewRenByIdOp' + - $ref: '#/components/schemas/ViewRenBySuppliedIdOp' + - $ref: '#/components/schemas/ViewRepByIdOp' + - $ref: '#/components/schemas/ViewRepByPredefinedIdOp' + - $ref: '#/components/schemas/ClearRepOp' SceneItemOverrideData_attributes: + additionalProperties: false properties: created: example: 2020-01-01T12:00:00Z @@ -13667,6 +13931,7 @@ components: - created type: object SceneItemOverrideData_relationships: + additionalProperties: false properties: sceneItem: $ref: '#/components/schemas/SceneItemRelationship' @@ -13722,7 +13987,7 @@ components: type: boolean metadata: additionalProperties: - $ref: '#/components/schemas/UpdatePartRevisionRequest_data_attributes_metadata_value' + $ref: '#/components/schemas/CreatePartRequest_data_attributes_metadata_value' description: | Additional metadata for the scene-item. This metadata will take precedence over any metadata that belongs to the part file. type: object @@ -13734,7 +13999,16 @@ components: maxItems: 500 type: array type: object + CreateSceneItemRequestData_relationships_source: + anyOf: + - $ref: '#/components/schemas/GeometrySetRelationship' + - $ref: '#/components/schemas/PartRevisionRelationship' + - $ref: '#/components/schemas/SceneRelationship' + - $ref: '#/components/schemas/PartRenditionRelationship' + description: "Relationship to a `geometry-set`, `part-revision`, `part-rendition`,\ + \ or `scene`." CreateSceneItemRequestData_relationships: + additionalProperties: false properties: parent: $ref: '#/components/schemas/SceneItemRelationship' @@ -13744,6 +14018,7 @@ components: $ref: '#/components/schemas/SceneItemRelationship' type: object SceneViewData_attributes: + additionalProperties: false properties: camera: $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' @@ -13764,6 +14039,7 @@ components: - created type: object SceneViewData_relationships: + additionalProperties: false properties: scene: $ref: '#/components/schemas/SceneRelationship' @@ -13771,6 +14047,7 @@ components: - scene type: object SceneViewStateRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13790,6 +14067,7 @@ components: - type type: object SceneData_attributes: + additionalProperties: false properties: camera: $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' @@ -13833,6 +14111,7 @@ components: type: object type: object SceneRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13852,6 +14131,7 @@ components: - type type: object SceneViewStateData_attributes: + additionalProperties: false properties: camera: $ref: '#/components/schemas/CreateSceneViewRequest_data_attributes_camera' @@ -13879,6 +14159,7 @@ components: type: string type: object SceneViewRelationship_data: + additionalProperties: false properties: type: description: Resource object type. @@ -13898,6 +14179,7 @@ components: - type type: object StreamKeyData_attributes: + additionalProperties: false properties: key: example: i3MFRDOmg1pxD36dGCTONRwOujkgV8m9LQ @@ -13918,6 +14200,7 @@ components: - expiry type: object SceneAnnotationSetData_attributes: + additionalProperties: false properties: createdAt: example: 2020-01-01T12:00:00Z @@ -13942,6 +14225,7 @@ components: - modifiedAt type: object SceneAnnotationData_attributes: + additionalProperties: false properties: createdAt: example: 2020-01-01T12:00:00Z @@ -13982,6 +14266,7 @@ components: - status type: object SceneSyncItemResultData_attributes: + additionalProperties: false properties: status: example: running @@ -13992,6 +14277,7 @@ components: - status type: object SceneSyncItemResultData_relationships: + additionalProperties: false properties: scene: $ref: '#/components/schemas/SceneRelationship' @@ -14001,39 +14287,8 @@ components: - scene - sceneItem type: object - QueuedTranslationJobData_attributes: - properties: - status: - example: running - type: string - created: - example: 2020-01-01T12:00:00Z - format: date-time - type: string - completed: - example: 2020-01-01T12:00:00Z - format: date-time - type: string - errors: - items: - $ref: '#/components/schemas/ApiError' - maxItems: 20 - type: array - uniqueItems: true - required: - - created - - status - type: object - QueuedTranslationJobData_relationships: - properties: - geometrySet: - $ref: '#/components/schemas/GeometrySetRelationship' - partRevision: - $ref: '#/components/schemas/PartRevisionRelationship' - partRendition: - $ref: '#/components/schemas/PartRenditionRelationship' - type: object ExportData_attributes: + additionalProperties: false properties: created: example: 2020-01-01T12:00:00Z @@ -14047,6 +14302,7 @@ components: - downloadUrl type: object WebhookSubscriptionData_attributes: + additionalProperties: false properties: url: type: string @@ -14075,6 +14331,7 @@ components: - url type: object QueryById_data_attributes: + additionalProperties: false properties: type: description: Resource object type. @@ -14093,6 +14350,7 @@ components: - value type: object QueryById_data: + additionalProperties: false properties: type: description: Resource object type. @@ -14108,6 +14366,7 @@ components: - type type: object QueryByCollection_data_attributes: + additionalProperties: false properties: type: description: Resource object type. @@ -14128,6 +14387,7 @@ components: - values type: object QueryByCollection_data: + additionalProperties: false properties: type: description: Resource object type. @@ -14143,6 +14403,7 @@ components: - type type: object WebhookEventDataRelationships_owner_data: + additionalProperties: false example: id: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 type: account @@ -14165,6 +14426,7 @@ components: - type type: object WebhookEventDataRelationships_owner: + additionalProperties: false description: Relationship to an `owner`. example: data: @@ -14181,6 +14443,7 @@ components: - data type: object WebhookEventDataRelationships_resource_data: + additionalProperties: false example: id: f79d4760-0b71-44e4-ad0b-22743fdd4ca3 type: queued-scene-item @@ -14201,6 +14464,7 @@ components: - type type: object WebhookEventDataRelationships_resource: + additionalProperties: false description: Relationship to a `resource`. example: data: @@ -14216,145 +14480,6 @@ components: required: - data type: object - Batch_vertexvis_batch_results_inner: - anyOf: - - $ref: '#/components/schemas/RelationshipData' - - $ref: '#/components/schemas/ApiError' - Hit_included_inner: - oneOf: - - $ref: '#/components/schemas/HitResultData' - - $ref: '#/components/schemas/SceneItemData' - - $ref: '#/components/schemas/PartRevisionData' - CreateSceneSyncRequest_operation: - discriminator: - mapping: - update-to-default-rendition: '#/components/schemas/UpdateItemToDefaultRenditionOperation' - propertyName: type - oneOf: - - $ref: '#/components/schemas/UpdateItemToDefaultRenditionOperation' - QueuedTranslationJob_included_inner: - anyOf: - - $ref: '#/components/schemas/GeometrySetData' - - $ref: '#/components/schemas/PartRevisionData' - - $ref: '#/components/schemas/PartRenditionData' - WebhookEvent_included_inner: - discriminator: - mapping: - scene: '#/components/schemas/WebhookEventSceneIncludedData' - part-revision: '#/components/schemas/WebhookEventPartRevisionIncludedData' - propertyName: type - oneOf: - - $ref: '#/components/schemas/WebhookEventSceneIncludedData' - - $ref: '#/components/schemas/WebhookEventPartRevisionIncludedData' - SceneOperation_query: - anyOf: - - $ref: '#/components/schemas/QueryById' - - $ref: '#/components/schemas/QueryByCollection' - - $ref: '#/components/schemas/QueryAll' - description: Query `scene-items`. Use `query-by-collection` to combine multiple - queries. - SceneOperation_operations_inner: - anyOf: - - $ref: '#/components/schemas/ChangeVisibilityOp' - - $ref: '#/components/schemas/ChangeMaterialOp' - - $ref: '#/components/schemas/ClearMaterialOp' - - $ref: '#/components/schemas/ChangeTransformOp' - - $ref: '#/components/schemas/ClearTransformOp' - - $ref: '#/components/schemas/SelectOp' - - $ref: '#/components/schemas/DeselectOperation' - - $ref: '#/components/schemas/ClearRenOp' - - $ref: '#/components/schemas/ViewDefaultRenOp' - - $ref: '#/components/schemas/ViewRenByIdOp' - - $ref: '#/components/schemas/ViewRenBySuppliedIdOp' - - $ref: '#/components/schemas/ViewRepByIdOp' - - $ref: '#/components/schemas/ViewRepByPredefinedIdOp' - - $ref: '#/components/schemas/ClearRepOp' - UpdatePartRevisionRequest_data_attributes_metadata_value: - anyOf: - - $ref: '#/components/schemas/MetadataLongType' - - $ref: '#/components/schemas/MetadataFloatType' - - $ref: '#/components/schemas/MetadataDateType' - - $ref: '#/components/schemas/MetadataStringType' - - $ref: '#/components/schemas/MetadataNullType' - CreatePartRequest_data_relationships_source: - anyOf: - - $ref: '#/components/schemas/FileRelationship' - - $ref: '#/components/schemas/PartAssemblyRelationship' - UpsertPropertyEntriesRequest_data_attributes_entries_value: - anyOf: - - $ref: '#/components/schemas/PropertyStringType' - - $ref: '#/components/schemas/PropertyDoubleType' - - $ref: '#/components/schemas/PropertyLongType' - - $ref: '#/components/schemas/PropertyDateType' - - nullable: true - type: object - nullable: true - UpsertPropertyEntriesRequest_data_relationships_propertySet: - anyOf: - - $ref: '#/components/schemas/PropertySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - - $ref: '#/components/schemas/SceneItemRelationship' - - $ref: '#/components/schemas/PartInstanceRelationship' - description: "Relationship to the property set by `property-set`, `part-revision`,\ - \ `part-instance` or `scene-item`." - UpdateSceneItemRequest_data_relationships_source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - description: Relationship to a `geometry-set` or `part-revision`. - UpdateSceneViewRequest_data_attributes_camera: - anyOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' - - $ref: '#/components/schemas/CameraFit' - CreateSceneViewRequest_data_attributes_camera: - oneOf: - - $ref: '#/components/schemas/PerspectiveCamera' - - $ref: '#/components/schemas/OrthographicCamera' - CreateSceneViewStateRequest_data_relationships_source: - oneOf: - - $ref: '#/components/schemas/SceneViewRelationship' - - $ref: '#/components/schemas/SceneViewStateRelationship' - CreateSceneAnnotationRequest_data_attributes_data: - description: The data describing how to render this annotation. - discriminator: - mapping: - callout: '#/components/schemas/SceneAnnotationCalloutDataType' - custom: '#/components/schemas/SceneAnnotationCustomDataType' - propertyName: type - oneOf: - - $ref: '#/components/schemas/SceneAnnotationCalloutDataType' - - $ref: '#/components/schemas/SceneAnnotationCustomDataType' - CreateExportRequest_data_attributes_config: - description: Specifies the export format and options to configure the export. - discriminator: - mapping: - jt: '#/components/schemas/CADExportConfig' - step: '#/components/schemas/CADExportConfig' - x_t: '#/components/schemas/CADExportConfig' - propertyName: format - oneOf: - - $ref: '#/components/schemas/CADExportConfig' - SceneItemData_relationships_source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - - $ref: '#/components/schemas/SceneRelationship' - - $ref: '#/components/schemas/PartRenditionRelationship' - PropertyEntryData_attributes_value: - anyOf: - - $ref: '#/components/schemas/PropertyStringType' - - $ref: '#/components/schemas/PropertyDoubleType' - - $ref: '#/components/schemas/PropertyLongType' - - $ref: '#/components/schemas/PropertyDateType' - CreateSceneItemRequestData_relationships_source: - anyOf: - - $ref: '#/components/schemas/GeometrySetRelationship' - - $ref: '#/components/schemas/PartRevisionRelationship' - - $ref: '#/components/schemas/SceneRelationship' - - $ref: '#/components/schemas/PartRenditionRelationship' - description: "Relationship to a `geometry-set`, `part-revision`, `part-rendition`,\ - \ or `scene`." securitySchemes: OAuth2: flows: diff --git a/scripts/generate.sh b/scripts/generate.sh index bd3ab56..7703d26 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -6,6 +6,7 @@ source "$scripts_dir/version-lib.sh" main() { local root=(example) + local auth=(RetryingOAuth.java ) local models=(MetadataDateType.java \ MetadataFloatType.java \ MetadataLongType.java \ @@ -13,6 +14,7 @@ main() { MetadataStringType.java ) mv "src/test" . || true for f in "${root[@]}"; do mv "src/main/java/com/vertexvis/$f" . || true; done + for f in "${auth[@]}"; do mv "src/main/java/com/vertexvis/auth/$f" . || true; done for f in "${models[@]}"; do mv "src/main/java/com/vertexvis/model/$f" . || true; done rm -rf api gradle src @@ -25,6 +27,7 @@ main() { mv ./test ./src for f in "${root[@]}"; do mv "$f" ./src/main/java/com/vertexvis; done + for f in "${auth[@]}"; do mv "$f" ./src/main/java/com/vertexvis/auth; done for f in "${models[@]}"; do mv "$f" ./src/main/java/com/vertexvis/model; done local version diff --git a/src/main/java/com/vertexvis/JSON.java b/src/main/java/com/vertexvis/JSON.java index 5a2614c..78610c3 100644 --- a/src/main/java/com/vertexvis/JSON.java +++ b/src/main/java/com/vertexvis/JSON.java @@ -217,12 +217,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequestData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateHitRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePart200Response.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequestData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRenditionRequestDataAttributes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataRelationships.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreatePartRequestDataRelationshipsSource.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.CreateSceneAlterationRequest.CustomTypeAdapterFactory()); @@ -295,6 +297,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetRelationship.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GeometrySetRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.GetQueuedSceneItem200Response.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.Hit.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.HitDataAttributes.CustomTypeAdapterFactory()); @@ -314,6 +317,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.MetadataStringType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelView.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewDataAttributes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewDataRelationships.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.ModelViewList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.OAuth2BadRequest.CustomTypeAdapterFactory()); @@ -326,7 +330,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataAttributes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataRelationships.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataRelationshipsPartRevisions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartDataRelationshipsPartRevisionsInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartInstanceRelationship.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartInstanceRelationshipData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PartList.CustomTypeAdapterFactory()); @@ -360,7 +364,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryDataAttributes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryDataAttributesValue.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyEntryList.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyKeyType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertyLongType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertySetRelationship.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.vertexvis.model.PropertySetRelationshipData.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/vertexvis/api/PartsApi.java b/src/main/java/com/vertexvis/api/PartsApi.java index d0b1ebd..0025567 100644 --- a/src/main/java/com/vertexvis/api/PartsApi.java +++ b/src/main/java/com/vertexvis/api/PartsApi.java @@ -27,6 +27,7 @@ import java.io.IOException; +import com.vertexvis.model.CreatePart200Response; import com.vertexvis.model.CreatePartRequest; import com.vertexvis.model.Failure; import com.vertexvis.model.Part; @@ -87,8 +88,7 @@ public void setCustomBaseUrl(String customBaseUrl) {
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
- - + @@ -154,21 +154,20 @@ private okhttp3.Call createPartValidateBeforeCall(CreatePartRequest createPartRe * * Create a `part`. This endpoint includes multiple successful response codes: [`201`, `202`]. When not given a relationship, this endpoint will create a part with an empty part revision and return a `201` status code of the part. When given a relationship to translate, this endpoint will return a `202` status code with the location of a `queued-translation`. The status of the translation can be queried via `getQueuedTranslation`. After the translation is complete, a `part` and `part-revision` that references the translated geometry. A unique suppliedId/suppliedRevisionId combination will create a new part and new part revision. For instance, sending my-part-id/my-revision-id will create a new part and new revision with those corresponding supplied ids. To create a new revision for `my-part-id`, likewise you can invoke this endpoint with a new revision id: `my-part-id/my-new-revision-id` and a new revision will be created for the existing part. See our [Import Data](https://developer.vertexvis.com/docs/guides/import-data-with-api) guides for more information. * @param createPartRequest (required) - * @return Part + * @return CreatePart200Response * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
200 Created Part -
400 Bad Request -
401 Unauthorized -
415 Unsupported Media Type -
- - +
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
200 Created Part -
400 Bad Request -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public Part createPart(CreatePartRequest createPartRequest) throws ApiException { - ApiResponse localVarResp = createPartWithHttpInfo(createPartRequest); + public CreatePart200Response createPart(CreatePartRequest createPartRequest) throws ApiException { + ApiResponse localVarResp = createPartWithHttpInfo(createPartRequest); return localVarResp.getData(); } @@ -176,22 +175,21 @@ public Part createPart(CreatePartRequest createPartRequest) throws ApiException * * Create a `part`. This endpoint includes multiple successful response codes: [`201`, `202`]. When not given a relationship, this endpoint will create a part with an empty part revision and return a `201` status code of the part. When given a relationship to translate, this endpoint will return a `202` status code with the location of a `queued-translation`. The status of the translation can be queried via `getQueuedTranslation`. After the translation is complete, a `part` and `part-revision` that references the translated geometry. A unique suppliedId/suppliedRevisionId combination will create a new part and new part revision. For instance, sending my-part-id/my-revision-id will create a new part and new revision with those corresponding supplied ids. To create a new revision for `my-part-id`, likewise you can invoke this endpoint with a new revision id: `my-part-id/my-new-revision-id` and a new revision will be created for the existing part. See our [Import Data](https://developer.vertexvis.com/docs/guides/import-data-with-api) guides for more information. * @param createPartRequest (required) - * @return ApiResponse<Part> + * @return ApiResponse<CreatePart200Response> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - - +
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
200 Created Part -
400 Bad Request -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public ApiResponse createPartWithHttpInfo(CreatePartRequest createPartRequest) throws ApiException { + public ApiResponse createPartWithHttpInfo(CreatePartRequest createPartRequest) throws ApiException { okhttp3.Call localVarCall = createPartValidateBeforeCall(createPartRequest, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -206,17 +204,16 @@ public ApiResponse createPartWithHttpInfo(CreatePartRequest createPartRequ - - +
Response Details
Status Code Description Response Headers
201 Created Part -
202 Accepted * content-location -
200 Created Part -
400 Bad Request -
401 Unauthorized -
415 Unsupported Media Type -
*/ - public okhttp3.Call createPartAsync(CreatePartRequest createPartRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createPartAsync(CreatePartRequest createPartRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = createPartValidateBeforeCall(createPartRequest, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/vertexvis/api/SceneItemsApi.java b/src/main/java/com/vertexvis/api/SceneItemsApi.java index b937996..d58c535 100644 --- a/src/main/java/com/vertexvis/api/SceneItemsApi.java +++ b/src/main/java/com/vertexvis/api/SceneItemsApi.java @@ -29,6 +29,7 @@ import com.vertexvis.model.CreateSceneItemRequest; import com.vertexvis.model.Failure; +import com.vertexvis.model.GetQueuedSceneItem200Response; import com.vertexvis.model.QueuedJob; import com.vertexvis.model.SceneItem; import com.vertexvis.model.SceneItemList; @@ -447,7 +448,7 @@ private okhttp3.Call getQueuedSceneItemValidateBeforeCall(UUID id, final ApiCall * * Get a `queued-scene-item`. The response is either the status if `running` or `error` or, upon completion, redirects to the created `scene-item`. Once created, commit the scene via the updateScene API. For details, see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) guide. * @param id The `queued-scene-item` ID. (required) - * @return QueuedJob + * @return GetQueuedSceneItem200Response * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -460,8 +461,8 @@ private okhttp3.Call getQueuedSceneItemValidateBeforeCall(UUID id, final ApiCall
415 Unsupported Media Type -
*/ - public QueuedJob getQueuedSceneItem(UUID id) throws ApiException { - ApiResponse localVarResp = getQueuedSceneItemWithHttpInfo(id); + public GetQueuedSceneItem200Response getQueuedSceneItem(UUID id) throws ApiException { + ApiResponse localVarResp = getQueuedSceneItemWithHttpInfo(id); return localVarResp.getData(); } @@ -469,7 +470,7 @@ public QueuedJob getQueuedSceneItem(UUID id) throws ApiException { * * Get a `queued-scene-item`. The response is either the status if `running` or `error` or, upon completion, redirects to the created `scene-item`. Once created, commit the scene via the updateScene API. For details, see our [Render static scenes](https://developer.vertexvis.com/docs/guides/render-static-scenes) guide. * @param id The `queued-scene-item` ID. (required) - * @return ApiResponse<QueuedJob> + * @return ApiResponse<GetQueuedSceneItem200Response> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -482,9 +483,9 @@ public QueuedJob getQueuedSceneItem(UUID id) throws ApiException {
415 Unsupported Media Type -
*/ - public ApiResponse getQueuedSceneItemWithHttpInfo(UUID id) throws ApiException { + public ApiResponse getQueuedSceneItemWithHttpInfo(UUID id) throws ApiException { okhttp3.Call localVarCall = getQueuedSceneItemValidateBeforeCall(id, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -506,10 +507,10 @@ public ApiResponse getQueuedSceneItemWithHttpInfo(UUID id) throws Api 415 Unsupported Media Type - */ - public okhttp3.Call getQueuedSceneItemAsync(UUID id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getQueuedSceneItemAsync(UUID id, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getQueuedSceneItemValidateBeforeCall(id, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/vertexvis/auth/RetryingOAuth.java b/src/main/java/com/vertexvis/auth/RetryingOAuth.java index ef9e6e8..d725761 100644 --- a/src/main/java/com/vertexvis/auth/RetryingOAuth.java +++ b/src/main/java/com/vertexvis/auth/RetryingOAuth.java @@ -1,26 +1,18 @@ -/* - * Vertex Platform API - * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@vertexvis.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - package com.vertexvis.auth; -import com.vertexvis.ApiException; import com.vertexvis.Pair; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.List; +import java.util.Map; + +import okhttp3.Credentials; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; - import org.apache.oltu.oauth2.client.OAuthClient; import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; @@ -29,195 +21,148 @@ import org.apache.oltu.oauth2.common.exception.OAuthProblemException; import org.apache.oltu.oauth2.common.exception.OAuthSystemException; import org.apache.oltu.oauth2.common.message.types.GrantType; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URI; -import java.util.Map; -import java.util.List; +import org.jetbrains.annotations.NotNull; public class RetryingOAuth extends OAuth implements Interceptor { - private OAuthClient oAuthClient; - - private TokenRequestBuilder tokenRequestBuilder; - - /** - * @param client An OkHttp client - * @param tokenRequestBuilder A token request builder - */ - public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { - this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); - this.tokenRequestBuilder = tokenRequestBuilder; + private final OAuthClient oAuthClient; + private final TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient( + new OkHttpClient.Builder() + .addInterceptor(new AuthInterceptor(clientId, clientSecret)) + .build())); + this.tokenRequestBuilder = OAuthClientRequest.tokenLocation(tokenUrl); + setFlow(flow); + if (parameters != null) { + for (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } } + } - /** - * @param tokenRequestBuilder A token request builder - */ - public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { - this(new OkHttpClient(), tokenRequestBuilder); + public void setFlow(OAuthFlow flow) { + if (flow == OAuthFlow.APPLICATION) { + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); } + } - /** - * @param tokenUrl The token URL to be used for this OAuth2 flow. - * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". - * The value must be an absolute URL. - * @param clientId The OAuth2 client ID for the "clientCredentials" flow. - * @param flow OAuth flow. - * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. - * @param parameters A map of string. - */ - public RetryingOAuth( - String tokenUrl, - String clientId, - OAuthFlow flow, - String clientSecret, - Map parameters - ) { - this(OAuthClientRequest.tokenLocation(tokenUrl) - .setClientId(clientId) - .setClientSecret(clientSecret)); - setFlow(flow); - if (parameters != null) { - for (Map.Entry entry : parameters.entrySet()) { - tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); - } - } - } + @NotNull + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } - /** - * Set the OAuth flow - * - * @param flow The OAuth flow. - */ - public void setFlow(OAuthFlow flow) { - switch(flow) { - case ACCESS_CODE: - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); - break; - case IMPLICIT: - tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); - break; - case PASSWORD: - tokenRequestBuilder.setGrantType(GrantType.PASSWORD); - break; - case APPLICATION: - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); - break; - default: - break; - } - } + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) + throws IOException { + Request request = chain.request(); - @Override - public Response intercept(Chain chain) throws IOException { - return retryingIntercept(chain, true); + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); } - private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { - Request request = chain.request(); - - // If the request already has an authorization (e.g. Basic auth), proceed with the request as is - if (request.header("Authorization") != null) { - return chain.proceed(request); - } - - // Get the token if it has not yet been acquired - if (getAccessToken() == null) { - updateAccessToken(null); - } - - OAuthClientRequest oAuthRequest; - if (getAccessToken() != null) { - // Build the request - Request.Builder requestBuilder = request.newBuilder(); - - String requestAccessToken = getAccessToken(); - try { - oAuthRequest = - new OAuthBearerClientRequest(request.url().toString()). - setAccessToken(requestAccessToken). - buildHeaderMessage(); - } catch (OAuthSystemException e) { - throw new IOException(e); - } - - Map headers = oAuthRequest.getHeaders(); - for (Map.Entry entry : headers.entrySet()) { - requestBuilder.addHeader(entry.getKey(), entry.getValue()); - } - requestBuilder.url(oAuthRequest.getLocationUri()); - - // Execute the request - Response response = chain.proceed(requestBuilder.build()); - - // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row - if ( - response != null && - ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || - response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && - updateTokenAndRetryOnAuthorizationFailure - ) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body().close(); - return retryingIntercept(chain, false); - } - } catch (Exception e) { - response.body().close(); - throw e; - } - } - return response; - } - else { - return chain.proceed(chain.request()); - } + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); } - /** - * Returns true if the access token has been updated - * - * @param requestAccessToken the request access token - * @return True if the update is successful - * @throws java.io.IOException If fail to update the access token - */ - public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { - if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { - try { - OAuthJSONAccessTokenResponse accessTokenResponse = - oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken()); - } - } catch (OAuthSystemException | OAuthProblemException e) { - throw new IOException(e); - } + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + (response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + updateAccessToken(requestAccessToken); + response.body().close(); + return retryingIntercept(chain, false); + } catch (Exception e) { + response.body().close(); + throw e; } - return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + return response; + } else { + return chain.proceed(chain.request()); } - - /** - * Gets the token request builder - * - * @return A token request builder - */ - public TokenRequestBuilder getTokenRequestBuilder() { - return tokenRequestBuilder; + } + + private synchronized void updateAccessToken(String requestAccessToken) throws IOException { + // if we don't have a token at all, we go get one + // if we are here and requestAccessToken is not equal to getAccessToken(), that means + // some other thread has already updated the token and we can just continue on to retry with the new token. + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } } - - /** - * Sets the token request builder - * - * @param tokenRequestBuilder Token request builder - */ - public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { - this.tokenRequestBuilder = tokenRequestBuilder; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) { + // No implementation necessary + } + + private static class AuthInterceptor implements Interceptor { + private final String clientId; + private final String clientSecret; + + public AuthInterceptor(String clientId, String clientSecret) { + this.clientId = clientId; + this.clientSecret = clientSecret; } - // Applying authorization to parameters is performed in the retryingIntercept method + @NotNull @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - // No implementation necessary + public Response intercept(Chain chain) throws IOException { + return chain.proceed( + chain.request() + .newBuilder().addHeader("Authorization", Credentials.basic(clientId, clientSecret)) + .build() + ); } + } } diff --git a/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java b/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java index e30afc7..f2326e5 100644 --- a/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java +++ b/src/main/java/com/vertexvis/example/CreateAssemblyFromRevisionsExample.java @@ -38,6 +38,7 @@ public void run() { ApiClient client = new ApiClient(getVertexApiUrl(), clientId, secret, new HashMap<>()).setDebugging(isVerboseDebugLogging()); + client.setServerIndex(null); PartCreator pc = new PartCreator(client); FilesApi files = new FilesApi(client); @@ -61,7 +62,7 @@ public void run() { Part assembly = newParts.stream() .map(part -> part.getData().getRelationships().getPartRevisions()) .flatMap(Collection::stream) - .map(PartDataRelationshipsPartRevisions::getId) + .map(PartDataRelationshipsPartRevisionsInner::getId) .peek(uuid -> logger.info(uuid.toString())) .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) .handle((part, ex) -> { diff --git a/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java b/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java index 3798f00..d2f7794 100644 --- a/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java +++ b/src/main/java/com/vertexvis/example/CreatePartRevisionsWithMetadataExample.java @@ -61,7 +61,7 @@ public void run() { Part assembly = newParts.stream() .map(part -> part.getData().getRelationships().getPartRevisions()) .flatMap(Collection::stream) - .map(PartDataRelationshipsPartRevisions::getId) + .map(PartDataRelationshipsPartRevisionsInner::getId) .peek(uuid -> logger.info("Part Revision Id: " + uuid)) .collect(Collectors.collectingAndThen(Collectors.toList(), (l) -> pc.createAssemblyFromRevisions(l, getAssemblyName()))) .handle((part, ex) -> { diff --git a/src/main/java/com/vertexvis/example/JobPoller.java b/src/main/java/com/vertexvis/example/JobPoller.java index fda8853..8af966f 100644 --- a/src/main/java/com/vertexvis/example/JobPoller.java +++ b/src/main/java/com/vertexvis/example/JobPoller.java @@ -1,6 +1,9 @@ package com.vertexvis.example; +import com.vertexvis.model.GetQueuedSceneItem200Response; import com.vertexvis.model.QueuedJob; +import com.vertexvis.model.QueuedTranslationJob; +import com.vertexvis.model.SceneItem; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -16,7 +19,7 @@ class JobPoller { Executors.newScheduledThreadPool(4); public static CompletableFuture pollUntilJobDoneAsync(String type, - Supplier> f) { + Supplier> f) { CompletableFuture cf = new CompletableFuture<>(); startChecking(cf, type, f); @@ -24,26 +27,39 @@ public static CompletableFuture pollUntilJobDoneAsync(String type, return cf; } + public static UUID pollSceneJobUntilDone(String type, Supplier f) + throws InterruptedException { + do { + GetQueuedSceneItem200Response qj = f.get(); + + if (qj.getActualInstance() instanceof SceneItem) { + return qj.getSceneItem().getData().getId(); + } + // Don't do this -- use a proper scheduler + Thread.sleep(DEFAULT_WAIT_TIME_MS); + } while (true); + } + public static UUID pollUntilJobDone(String type, Supplier f) throws InterruptedException { - // Don't do this -- use a proper scheduler - Thread.sleep(DEFAULT_WAIT_TIME_MS); - QueuedJob qj = f.get(); + do { + QueuedJob qj = f.get(); - if (qj.getData().getType().equals(type)) { - return qj.getData().getId(); - } else { - return pollUntilJobDone(type, f); - } + if (qj.getData().getType().equals(type)) { + return qj.getData().getId(); + } + // Don't do this -- use a proper scheduler + Thread.sleep(DEFAULT_WAIT_TIME_MS); + } while (true); } private static void startChecking(CompletableFuture resultF, String type, - Supplier> f) { + Supplier> f) { scheduler.schedule(() -> { f.get().thenAccept(qj -> { if (qj.getData().getType().equals(type)) { - resultF.complete(qj.getData().getId()); + resultF.complete(qj.getIncluded().get(0).getPartRevisionData().getRelationships().getPart().getId()); } else { startChecking(resultF, type, f); } diff --git a/src/main/java/com/vertexvis/example/MetadataUtil.java b/src/main/java/com/vertexvis/example/MetadataUtil.java index a7256ad..bb9fb17 100644 --- a/src/main/java/com/vertexvis/example/MetadataUtil.java +++ b/src/main/java/com/vertexvis/example/MetadataUtil.java @@ -20,7 +20,7 @@ enum MetadataType { NULL } - public static Map createCustomMetadata(int numberOfMetadataProperties) { + public static Map createCustomMetadata(int numberOfMetadataProperties) { return IntStream.range(0, numberOfMetadataProperties).mapToObj(i -> { // generate key that index of the number of metadata properties var key = "key_0" + (i + 1) + "/" + numberOfMetadataProperties; @@ -28,20 +28,20 @@ public static Map var metadataType = random.nextInt(MetadataType.values().length); var value = switch (MetadataType.values()[metadataType]) { case LONG -> - new UpdatePartRevisionRequestDataAttributesMetadataValue( + new CreatePartRequestDataAttributesMetadataValue( new MetadataLongType().type("long").value(random.nextLong())); case FLOAT -> - new UpdatePartRevisionRequestDataAttributesMetadataValue( + new CreatePartRequestDataAttributesMetadataValue( new MetadataFloatType().type("float").value(random.nextFloat())); case DATE -> - new UpdatePartRevisionRequestDataAttributesMetadataValue( + new CreatePartRequestDataAttributesMetadataValue( new MetadataDateType().type("date").value(OffsetDateTime.now())); case STRING -> - new UpdatePartRevisionRequestDataAttributesMetadataValue( + new CreatePartRequestDataAttributesMetadataValue( new MetadataStringType().type("string").value(UUID.randomUUID().toString())); case NULL -> - new UpdatePartRevisionRequestDataAttributesMetadataValue( + new CreatePartRequestDataAttributesMetadataValue( new MetadataNullType().type("null")); }; diff --git a/src/main/java/com/vertexvis/example/PartCreator.java b/src/main/java/com/vertexvis/example/PartCreator.java index 4e5f163..dee80cd 100644 --- a/src/main/java/com/vertexvis/example/PartCreator.java +++ b/src/main/java/com/vertexvis/example/PartCreator.java @@ -30,10 +30,10 @@ public Part createPartFromFile(FileMetadata metadata) throws InterruptedExceptio return createPartFromFile(metadata, Collections.emptyMap()); } - public Part createPartFromFile(FileMetadata metadata, Map partMetadata) throws InterruptedException { - Part qp = parts.createPart(getCreatePartRequest(metadata.getData().getId(), metadata.getData().getAttributes().getName(), partMetadata)); + public Part createPartFromFile(FileMetadata metadata, Map partMetadata) throws InterruptedException { + CreatePart200Response qp = parts.createPart(getCreatePartRequest(metadata.getData().getId(), metadata.getData().getAttributes().getName(), partMetadata)); UUID partId = - JobPoller.pollUntilJobDone("part", () -> tiApi.getQueuedTranslation(qp.getData().getId())); + JobPoller.pollUntilJobDone("part", () -> tiApi.getQueuedTranslation(qp.getQueuedTranslationJob().getData().getId())); return parts.getPart(partId, null); } @@ -41,29 +41,29 @@ public CompletableFuture createPartFromFileAsync(UUID id, CreateFileReques return createPartFromFileAsync(id, req, Collections.emptyMap()); } - public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req, Map metadata) { - CompletableFuture p = + public CompletableFuture createPartFromFileAsync(UUID id, CreateFileRequest req, Map metadata) { + CompletableFuture p = execute(cb -> parts.createPartAsync(getCreatePartRequest(id, req.getData().getAttributes().getName(), metadata), cb)); CompletableFuture partId = p.thenCompose(qj -> - JobPoller.pollUntilJobDoneAsync("part", () -> - execute(cb -> tiApi.getQueuedTranslationAsync(qj.getData().getId(), cb)))); + JobPoller.pollUntilJobDoneAsync("queued-translation-job", () -> + execute(cb -> tiApi.getQueuedTranslationJobAsync(qj.getQueuedTranslationJob().getData().getId(), cb)))); return partId.thenCompose( pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId, null, cb))); } public CompletableFuture createAssemblyFromRevisions(List revisions, String name) { - CompletableFuture p = + CompletableFuture p = execute(cb -> parts.createPartAsync(createPartAssemblyRequest(revisions, name), cb)); return p.thenCompose( - pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId.getData().getId(), null, cb))); + pId -> execute((ApiCallback cb) -> parts.getPartAsync(pId.getPart().getData().getId(), null, cb))); } private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName) { return getCreatePartRequest(fileId, partName, Collections.emptyMap()); } - private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName, Map metadata) { + private static CreatePartRequest getCreatePartRequest(UUID fileId, String partName, Map metadata) { FileRelationship fileRelationship = new FileRelationship() .data( new FileRelationshipData() diff --git a/src/main/java/com/vertexvis/example/SceneCreator.java b/src/main/java/com/vertexvis/example/SceneCreator.java index 3643a86..7411653 100644 --- a/src/main/java/com/vertexvis/example/SceneCreator.java +++ b/src/main/java/com/vertexvis/example/SceneCreator.java @@ -48,37 +48,36 @@ public Scene createSceneFromPart(Part p, boolean commitChanges) throws Interrupt UUID revisionId = p.getData().getRelationships().getPartRevisions().get(0).getId(); var name = Optional.of(p.getData().getAttributes()).map(PartDataAttributes::getName).orElse("ACube"); Scene scene = - scenes.createScene( - new CreateSceneRequest() - .data( - new CreateSceneRequestData() - .type("scene") - .attributes(new CreateSceneRequestDataAttributes().name(name).treeEnabled(true)))); + scenes.createScene( + new CreateSceneRequest() + .data( + new CreateSceneRequestData() + .type("scene") + .attributes(new CreateSceneRequestDataAttributes().name(name).treeEnabled(true)))); QueuedJob job = - sceneItems.createSceneItem( - scene.getData().getId(), - new CreateSceneItemRequest() - .data( - new CreateSceneItemRequestData() - .type("scene-item") - .attributes( - new CreateSceneItemRequestDataAttributes().suppliedId("my-part")) - .relationships( - new CreateSceneItemRequestDataRelationships() - .source( - new CreateSceneItemRequestDataRelationshipsSource( - new PartRevisionRelationship() - .data( - new PartDataRelationshipsPartRevisions() - .type( - PartDataRelationshipsPartRevisions.TypeEnum - .PART_REVISION) - .id(revisionId))))))); - - JobPoller.pollUntilJobDone( - "scene-item", () -> sceneItems.getQueuedSceneItem(job.getData().getId())); + sceneItems.createSceneItem( + scene.getData().getId(), + new CreateSceneItemRequest() + .data( + new CreateSceneItemRequestData() + .type("scene-item") + .attributes( + new CreateSceneItemRequestDataAttributes().suppliedId("my-part")) + .relationships( + new CreateSceneItemRequestDataRelationships() + .source( + new CreateSceneItemRequestDataRelationshipsSource( + new PartRevisionRelationship() + .data( + new PartDataRelationshipsPartRevisionsInner() + .type( + PartDataRelationshipsPartRevisionsInner.TypeEnum + .PART_REVISION) + .id(revisionId))))))); + JobPoller.pollSceneJobUntilDone( + "queued-scene-item", () -> sceneItems.getQueuedSceneItem(job.getData().getId())); return commitChanges ? commitSceneChanges(scene.getData().getId()) : scene; } diff --git a/src/main/java/com/vertexvis/model/CreatePart200Response.java b/src/main/java/com/vertexvis/model/CreatePart200Response.java new file mode 100644 index 0000000..f2aaff3 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreatePart200Response.java @@ -0,0 +1,282 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.Part; +import com.vertexvis.model.QueuedTranslationJob; +import com.vertexvis.model.QueuedTranslationJobData; +import com.vertexvis.model.QueuedTranslationJobIncludedInner; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreatePart200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreatePart200Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePart200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePart200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPart = gson.getDelegateAdapter(this, TypeToken.get(Part.class)); + final TypeAdapter adapterQueuedTranslationJob = gson.getDelegateAdapter(this, TypeToken.get(QueuedTranslationJob.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePart200Response value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Part` + if (value.getActualInstance() instanceof Part) { + JsonElement element = adapterPart.toJsonTree((Part)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `QueuedTranslationJob` + if (value.getActualInstance() instanceof QueuedTranslationJob) { + JsonElement element = adapterQueuedTranslationJob.toJsonTree((QueuedTranslationJob)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Part, QueuedTranslationJob"); + } + + @Override + public CreatePart200Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Part + try { + // validate the JSON object to see if any exception is thrown + Part.validateJsonElement(jsonElement); + actualAdapter = adapterPart; + match++; + log.log(Level.FINER, "Input data matches schema 'Part'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Part failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Part'", e); + } + // deserialize QueuedTranslationJob + try { + // validate the JSON object to see if any exception is thrown + QueuedTranslationJob.validateJsonElement(jsonElement); + actualAdapter = adapterQueuedTranslationJob; + match++; + log.log(Level.FINER, "Input data matches schema 'QueuedTranslationJob'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for QueuedTranslationJob failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'QueuedTranslationJob'", e); + } + + if (match == 1) { + CreatePart200Response ret = new CreatePart200Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreatePart200Response: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreatePart200Response() { + super("oneOf", Boolean.FALSE); + } + + public CreatePart200Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Part", Part.class); + schemas.put("QueuedTranslationJob", QueuedTranslationJob.class); + } + + @Override + public Map> getSchemas() { + return CreatePart200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Part, QueuedTranslationJob + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Part) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof QueuedTranslationJob) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Part, QueuedTranslationJob"); + } + + /** + * Get the actual instance, which can be the following: + * Part, QueuedTranslationJob + * + * @return The actual instance (Part, QueuedTranslationJob) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Part`. If the actual instance is not `Part`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Part` + * @throws ClassCastException if the instance is not `Part` + */ + public Part getPart() throws ClassCastException { + return (Part)super.getActualInstance(); + } + + /** + * Get the actual instance of `QueuedTranslationJob`. If the actual instance is not `QueuedTranslationJob`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `QueuedTranslationJob` + * @throws ClassCastException if the instance is not `QueuedTranslationJob` + */ + public QueuedTranslationJob getQueuedTranslationJob() throws ClassCastException { + return (QueuedTranslationJob)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePart200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with Part + try { + Part.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for Part failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with QueuedTranslationJob + try { + QueuedTranslationJob.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for QueuedTranslationJob failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreatePart200Response with oneOf schemas: Part, QueuedTranslationJob. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreatePart200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePart200Response + * @throws IOException if the JSON string is invalid with respect to CreatePart200Response + */ + public static CreatePart200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePart200Response.class); + } + + /** + * Convert an instance of CreatePart200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java index 64020f6..232044c 100644 --- a/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributes.java @@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; @@ -76,7 +76,7 @@ public class CreatePartRequestDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -182,12 +182,12 @@ public void setIndexMetadata(@javax.annotation.Nullable Boolean indexMetadata) { } - public CreatePartRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + public CreatePartRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public CreatePartRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public CreatePartRequestDataAttributes putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -200,11 +200,11 @@ public CreatePartRequestDataAttributes putMetadataItem(String key, UpdatePartRev * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributesMetadataValue.java b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributesMetadataValue.java new file mode 100644 index 0000000..1b4ded5 --- /dev/null +++ b/src/main/java/com/vertexvis/model/CreatePartRequestDataAttributesMetadataValue.java @@ -0,0 +1,405 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.MetadataDateType; +import com.vertexvis.model.MetadataFloatType; +import com.vertexvis.model.MetadataLongType; +import com.vertexvis.model.MetadataNullType; +import com.vertexvis.model.MetadataStringType; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class CreatePartRequestDataAttributesMetadataValue extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreatePartRequestDataAttributesMetadataValue.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePartRequestDataAttributesMetadataValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePartRequestDataAttributesMetadataValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterMetadataLongType = gson.getDelegateAdapter(this, TypeToken.get(MetadataLongType.class)); + final TypeAdapter adapterMetadataFloatType = gson.getDelegateAdapter(this, TypeToken.get(MetadataFloatType.class)); + final TypeAdapter adapterMetadataDateType = gson.getDelegateAdapter(this, TypeToken.get(MetadataDateType.class)); + final TypeAdapter adapterMetadataStringType = gson.getDelegateAdapter(this, TypeToken.get(MetadataStringType.class)); + final TypeAdapter adapterMetadataNullType = gson.getDelegateAdapter(this, TypeToken.get(MetadataNullType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePartRequestDataAttributesMetadataValue value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `MetadataLongType` + if (value.getActualInstance() instanceof MetadataLongType) { + JsonElement element = adapterMetadataLongType.toJsonTree((MetadataLongType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataFloatType` + if (value.getActualInstance() instanceof MetadataFloatType) { + JsonElement element = adapterMetadataFloatType.toJsonTree((MetadataFloatType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataDateType` + if (value.getActualInstance() instanceof MetadataDateType) { + JsonElement element = adapterMetadataDateType.toJsonTree((MetadataDateType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataStringType` + if (value.getActualInstance() instanceof MetadataStringType) { + JsonElement element = adapterMetadataStringType.toJsonTree((MetadataStringType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `MetadataNullType` + if (value.getActualInstance() instanceof MetadataNullType) { + JsonElement element = adapterMetadataNullType.toJsonTree((MetadataNullType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); + } + + @Override + public CreatePartRequestDataAttributesMetadataValue read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize MetadataLongType + try { + // validate the JSON object to see if any exception is thrown + MetadataLongType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataLongType; + CreatePartRequestDataAttributesMetadataValue ret = new CreatePartRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataLongType'", e); + } + // deserialize MetadataFloatType + try { + // validate the JSON object to see if any exception is thrown + MetadataFloatType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataFloatType; + CreatePartRequestDataAttributesMetadataValue ret = new CreatePartRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataFloatType'", e); + } + // deserialize MetadataDateType + try { + // validate the JSON object to see if any exception is thrown + MetadataDateType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataDateType; + CreatePartRequestDataAttributesMetadataValue ret = new CreatePartRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataDateType'", e); + } + // deserialize MetadataStringType + try { + // validate the JSON object to see if any exception is thrown + MetadataStringType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataStringType; + CreatePartRequestDataAttributesMetadataValue ret = new CreatePartRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataStringType'", e); + } + // deserialize MetadataNullType + try { + // validate the JSON object to see if any exception is thrown + MetadataNullType.validateJsonElement(jsonElement); + actualAdapter = adapterMetadataNullType; + CreatePartRequestDataAttributesMetadataValue ret = new CreatePartRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'MetadataNullType'", e); + } + + throw new IOException(String.format("Failed deserialization for CreatePartRequestDataAttributesMetadataValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public CreatePartRequestDataAttributesMetadataValue() { + super("anyOf", Boolean.FALSE); + } + + public CreatePartRequestDataAttributesMetadataValue(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("MetadataLongType", MetadataLongType.class); + schemas.put("MetadataFloatType", MetadataFloatType.class); + schemas.put("MetadataDateType", MetadataDateType.class); + schemas.put("MetadataStringType", MetadataStringType.class); + schemas.put("MetadataNullType", MetadataNullType.class); + } + + @Override + public Map> getSchemas() { + return CreatePartRequestDataAttributesMetadataValue.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof MetadataLongType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataFloatType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataDateType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataStringType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof MetadataNullType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); + } + + /** + * Get the actual instance, which can be the following: + * MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType + * + * @return The actual instance (MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataLongType`. If the actual instance is not `MetadataLongType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataLongType` + * @throws ClassCastException if the instance is not `MetadataLongType` + */ + public MetadataLongType getMetadataLongType() throws ClassCastException { + return (MetadataLongType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataFloatType`. If the actual instance is not `MetadataFloatType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataFloatType` + * @throws ClassCastException if the instance is not `MetadataFloatType` + */ + public MetadataFloatType getMetadataFloatType() throws ClassCastException { + return (MetadataFloatType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataDateType`. If the actual instance is not `MetadataDateType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataDateType` + * @throws ClassCastException if the instance is not `MetadataDateType` + */ + public MetadataDateType getMetadataDateType() throws ClassCastException { + return (MetadataDateType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataStringType`. If the actual instance is not `MetadataStringType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataStringType` + * @throws ClassCastException if the instance is not `MetadataStringType` + */ + public MetadataStringType getMetadataStringType() throws ClassCastException { + return (MetadataStringType)super.getActualInstance(); + } + + /** + * Get the actual instance of `MetadataNullType`. If the actual instance is not `MetadataNullType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `MetadataNullType` + * @throws ClassCastException if the instance is not `MetadataNullType` + */ + public MetadataNullType getMetadataNullType() throws ClassCastException { + return (MetadataNullType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePartRequestDataAttributesMetadataValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with MetadataLongType + try { + MetadataLongType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataFloatType + try { + MetadataFloatType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataDateType + try { + MetadataDateType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataStringType + try { + MetadataStringType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with MetadataNullType + try { + MetadataNullType.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for CreatePartRequestDataAttributesMetadataValue with anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of CreatePartRequestDataAttributesMetadataValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePartRequestDataAttributesMetadataValue + * @throws IOException if the JSON string is invalid with respect to CreatePartRequestDataAttributesMetadataValue + */ + public static CreatePartRequestDataAttributesMetadataValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePartRequestDataAttributesMetadataValue.class); + } + + /** + * Convert an instance of CreatePartRequestDataAttributesMetadataValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java index 044dee3..063ea8c 100644 --- a/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/CreateSceneItemRequestDataAttributes.java @@ -20,9 +20,9 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.ColorMaterial; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import com.vertexvis.model.Matrix4; import com.vertexvis.model.PartRevisionSuppliedId; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -116,7 +116,7 @@ public class CreateSceneItemRequestDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_EXPERIMENTAL_SOURCE_METADATA_KEYS = "experimentalSourceMetadataKeys"; @SerializedName(SERIALIZED_NAME_EXPERIMENTAL_SOURCE_METADATA_KEYS) @@ -335,12 +335,12 @@ public void setEndItem(@javax.annotation.Nullable Boolean endItem) { } - public CreateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + public CreateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public CreateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public CreateSceneItemRequestDataAttributes putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -353,11 +353,11 @@ public CreateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePa * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/GetQueuedSceneItem200Response.java b/src/main/java/com/vertexvis/model/GetQueuedSceneItem200Response.java new file mode 100644 index 0000000..575c6ee --- /dev/null +++ b/src/main/java/com/vertexvis/model/GetQueuedSceneItem200Response.java @@ -0,0 +1,279 @@ +/* + * Vertex Platform API + * The Vertex distributed cloud rendering platform includes a set of APIs and SDKs, which together allow easily integrating 3D product data into your business application. See our [Developer Guides](https://developer.vertexvis.com/docs/guides/render-your-first-scene) to get started. Notes about the Postman collection and API Reference code samples: - They include all required and optional body parameters for completeness. Remove any optional parameters as desired. - They use auto-generated IDs and other values that may share the same value for ease of documentation only. In actual requests and responses, the IDs should uniquely identify their corresponding resource. + * + * The version of the OpenAPI document: 1.0 + * Contact: support@vertexvis.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.vertexvis.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.Link; +import com.vertexvis.model.QueuedJob; +import com.vertexvis.model.SceneItem; +import com.vertexvis.model.SceneItemData; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.vertexvis.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class GetQueuedSceneItem200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GetQueuedSceneItem200Response.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetQueuedSceneItem200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetQueuedSceneItem200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterQueuedJob = gson.getDelegateAdapter(this, TypeToken.get(QueuedJob.class)); + final TypeAdapter adapterSceneItem = gson.getDelegateAdapter(this, TypeToken.get(SceneItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetQueuedSceneItem200Response value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `QueuedJob` + if (value.getActualInstance() instanceof QueuedJob) { + JsonElement element = adapterQueuedJob.toJsonTree((QueuedJob)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SceneItem` + if (value.getActualInstance() instanceof SceneItem) { + JsonElement element = adapterSceneItem.toJsonTree((SceneItem)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: QueuedJob, SceneItem"); + } + + @Override + public GetQueuedSceneItem200Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize QueuedJob + try { + // validate the JSON object to see if any exception is thrown + QueuedJob.validateJsonElement(jsonElement); + actualAdapter = adapterQueuedJob; + match++; + log.log(Level.FINER, "Input data matches schema 'QueuedJob'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for QueuedJob failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'QueuedJob'", e); + } + // deserialize SceneItem + try { + // validate the JSON object to see if any exception is thrown + SceneItem.validateJsonElement(jsonElement); + actualAdapter = adapterSceneItem; + match++; + log.log(Level.FINER, "Input data matches schema 'SceneItem'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SceneItem failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SceneItem'", e); + } + + if (match == 1) { + GetQueuedSceneItem200Response ret = new GetQueuedSceneItem200Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for GetQueuedSceneItem200Response: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public GetQueuedSceneItem200Response() { + super("oneOf", Boolean.FALSE); + } + + public GetQueuedSceneItem200Response(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("QueuedJob", QueuedJob.class); + schemas.put("SceneItem", SceneItem.class); + } + + @Override + public Map> getSchemas() { + return GetQueuedSceneItem200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * QueuedJob, SceneItem + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof QueuedJob) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SceneItem) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be QueuedJob, SceneItem"); + } + + /** + * Get the actual instance, which can be the following: + * QueuedJob, SceneItem + * + * @return The actual instance (QueuedJob, SceneItem) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `QueuedJob`. If the actual instance is not `QueuedJob`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `QueuedJob` + * @throws ClassCastException if the instance is not `QueuedJob` + */ + public QueuedJob getQueuedJob() throws ClassCastException { + return (QueuedJob)super.getActualInstance(); + } + + /** + * Get the actual instance of `SceneItem`. If the actual instance is not `SceneItem`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SceneItem` + * @throws ClassCastException if the instance is not `SceneItem` + */ + public SceneItem getSceneItem() throws ClassCastException { + return (SceneItem)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetQueuedSceneItem200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with QueuedJob + try { + QueuedJob.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for QueuedJob failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SceneItem + try { + SceneItem.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SceneItem failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for GetQueuedSceneItem200Response with oneOf schemas: QueuedJob, SceneItem. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of GetQueuedSceneItem200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetQueuedSceneItem200Response + * @throws IOException if the JSON string is invalid with respect to GetQueuedSceneItem200Response + */ + public static GetQueuedSceneItem200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetQueuedSceneItem200Response.class); + } + + /** + * Convert an instance of GetQueuedSceneItem200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/vertexvis/model/ModelViewData.java b/src/main/java/com/vertexvis/model/ModelViewData.java index 00dd67a..20c4ea5 100644 --- a/src/main/java/com/vertexvis/model/ModelViewData.java +++ b/src/main/java/com/vertexvis/model/ModelViewData.java @@ -19,8 +19,8 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.CreateAccountRequestDataAttributes; import com.vertexvis.model.Link; +import com.vertexvis.model.ModelViewDataAttributes; import com.vertexvis.model.ModelViewDataRelationships; import java.io.IOException; import java.util.Arrays; @@ -69,7 +69,7 @@ public class ModelViewData { public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) @javax.annotation.Nonnull - private CreateAccountRequestDataAttributes attributes; + private ModelViewDataAttributes attributes; public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) @@ -122,7 +122,7 @@ public void setId(@javax.annotation.Nonnull UUID id) { } - public ModelViewData attributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + public ModelViewData attributes(@javax.annotation.Nonnull ModelViewDataAttributes attributes) { this.attributes = attributes; return this; } @@ -132,11 +132,11 @@ public ModelViewData attributes(@javax.annotation.Nonnull CreateAccountRequestDa * @return attributes */ @javax.annotation.Nonnull - public CreateAccountRequestDataAttributes getAttributes() { + public ModelViewDataAttributes getAttributes() { return attributes; } - public void setAttributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull ModelViewDataAttributes attributes) { this.attributes = attributes; } @@ -289,7 +289,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the required field `attributes` - CreateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + ModelViewDataAttributes.validateJsonElement(jsonObj.get("attributes")); // validate the required field `relationships` ModelViewDataRelationships.validateJsonElement(jsonObj.get("relationships")); } diff --git a/src/main/java/com/vertexvis/model/PropertyKeyType.java b/src/main/java/com/vertexvis/model/ModelViewDataAttributes.java similarity index 58% rename from src/main/java/com/vertexvis/model/PropertyKeyType.java rename to src/main/java/com/vertexvis/model/ModelViewDataAttributes.java index 2f96b79..b4000fe 100644 --- a/src/main/java/com/vertexvis/model/PropertyKeyType.java +++ b/src/main/java/com/vertexvis/model/ModelViewDataAttributes.java @@ -46,97 +46,19 @@ import com.vertexvis.JSON; /** - * PropertyKeyType + * ModelViewDataAttributes */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") -public class PropertyKeyType { - /** - * The key category - */ - @JsonAdapter(CategoryEnum.Adapter.class) - public enum CategoryEnum { - VENDOR("vendor"), - - VERTEX("vertex"), - - USER("user"); - - private String value; - - CategoryEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static CategoryEnum fromValue(String value) { - for (CategoryEnum b : CategoryEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final CategoryEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CategoryEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CategoryEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - CategoryEnum.fromValue(value); - } - } - - public static final String SERIALIZED_NAME_CATEGORY = "category"; - @SerializedName(SERIALIZED_NAME_CATEGORY) - @javax.annotation.Nonnull - private CategoryEnum category; - +public class ModelViewDataAttributes { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; - public PropertyKeyType() { - } - - public PropertyKeyType category(@javax.annotation.Nonnull CategoryEnum category) { - this.category = category; - return this; - } - - /** - * The key category - * @return category - */ - @javax.annotation.Nonnull - public CategoryEnum getCategory() { - return category; + public ModelViewDataAttributes() { } - public void setCategory(@javax.annotation.Nonnull CategoryEnum category) { - this.category = category; - } - - - public PropertyKeyType name(@javax.annotation.Nonnull String name) { + public ModelViewDataAttributes name(@javax.annotation.Nonnull String name) { this.name = name; return this; } @@ -164,21 +86,19 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PropertyKeyType propertyKeyType = (PropertyKeyType) o; - return Objects.equals(this.category, propertyKeyType.category) && - Objects.equals(this.name, propertyKeyType.name); + ModelViewDataAttributes modelViewDataAttributes = (ModelViewDataAttributes) o; + return Objects.equals(this.name, modelViewDataAttributes.name); } @Override public int hashCode() { - return Objects.hash(category, name); + return Objects.hash(name); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PropertyKeyType {\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("class ModelViewDataAttributes {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); @@ -202,12 +122,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("category"); openapiFields.add("name"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("category"); openapiRequiredFields.add("name"); } @@ -215,35 +133,30 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to PropertyKeyType + * @throws IOException if the JSON Element is invalid with respect to ModelViewDataAttributes */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!PropertyKeyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyKeyType is not found in the empty JSON string", PropertyKeyType.openapiRequiredFields.toString())); + if (!ModelViewDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelViewDataAttributes is not found in the empty JSON string", ModelViewDataAttributes.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!PropertyKeyType.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyKeyType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!ModelViewDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelViewDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : PropertyKeyType.openapiRequiredFields) { + for (String requiredField : ModelViewDataAttributes.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("category").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("category").toString())); - } - // validate the required field `category` - CategoryEnum.validateJsonElement(jsonObj.get("category")); if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } @@ -253,22 +166,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!PropertyKeyType.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PropertyKeyType' and its subtypes + if (!ModelViewDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelViewDataAttributes' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(PropertyKeyType.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelViewDataAttributes.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, PropertyKeyType value) throws IOException { + public void write(JsonWriter out, ModelViewDataAttributes value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public PropertyKeyType read(JsonReader in) throws IOException { + public ModelViewDataAttributes read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -279,18 +192,18 @@ public PropertyKeyType read(JsonReader in) throws IOException { } /** - * Create an instance of PropertyKeyType given an JSON string + * Create an instance of ModelViewDataAttributes given an JSON string * * @param jsonString JSON string - * @return An instance of PropertyKeyType - * @throws IOException if the JSON string is invalid with respect to PropertyKeyType + * @return An instance of ModelViewDataAttributes + * @throws IOException if the JSON string is invalid with respect to ModelViewDataAttributes */ - public static PropertyKeyType fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PropertyKeyType.class); + public static ModelViewDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelViewDataAttributes.class); } /** - * Convert an instance of PropertyKeyType to an JSON string + * Convert an instance of ModelViewDataAttributes to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java b/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java index 071e42a..3b9423d 100644 --- a/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java +++ b/src/main/java/com/vertexvis/model/PartAssemblyRelationshipData.java @@ -19,8 +19,8 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import com.vertexvis.model.PartRevisionInstance; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -64,7 +64,7 @@ public class PartAssemblyRelationshipData { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public PartAssemblyRelationshipData() { } @@ -96,12 +96,12 @@ public void setChildren(@javax.annotation.Nonnull List chi } - public PartAssemblyRelationshipData metadata(@javax.annotation.Nullable Map metadata) { + public PartAssemblyRelationshipData metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public PartAssemblyRelationshipData putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public PartAssemblyRelationshipData putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -114,11 +114,11 @@ public PartAssemblyRelationshipData putMetadataItem(String key, UpdatePartRevisi * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/PartDataRelationships.java b/src/main/java/com/vertexvis/model/PartDataRelationships.java index 5b36d1f..0e1d0d5 100644 --- a/src/main/java/com/vertexvis/model/PartDataRelationships.java +++ b/src/main/java/com/vertexvis/model/PartDataRelationships.java @@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.PartDataRelationshipsPartRevisions; +import com.vertexvis.model.PartDataRelationshipsPartRevisionsInner; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -56,17 +56,17 @@ public class PartDataRelationships { public static final String SERIALIZED_NAME_PART_REVISIONS = "partRevisions"; @SerializedName(SERIALIZED_NAME_PART_REVISIONS) @javax.annotation.Nonnull - private List partRevisions = new ArrayList<>(); + private List partRevisions = new ArrayList<>(); public PartDataRelationships() { } - public PartDataRelationships partRevisions(@javax.annotation.Nonnull List partRevisions) { + public PartDataRelationships partRevisions(@javax.annotation.Nonnull List partRevisions) { this.partRevisions = partRevisions; return this; } - public PartDataRelationships addPartRevisionsItem(PartDataRelationshipsPartRevisions partRevisionsItem) { + public PartDataRelationships addPartRevisionsItem(PartDataRelationshipsPartRevisionsInner partRevisionsItem) { if (this.partRevisions == null) { this.partRevisions = new ArrayList<>(); } @@ -79,11 +79,11 @@ public PartDataRelationships addPartRevisionsItem(PartDataRelationshipsPartRevis * @return partRevisions */ @javax.annotation.Nonnull - public List getPartRevisions() { + public List getPartRevisions() { return partRevisions; } - public void setPartRevisions(@javax.annotation.Nonnull List partRevisions) { + public void setPartRevisions(@javax.annotation.Nonnull List partRevisions) { this.partRevisions = partRevisions; } @@ -176,7 +176,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti JsonArray jsonArraypartRevisions = jsonObj.getAsJsonArray("partRevisions"); // validate the required field `partRevisions` (array) for (int i = 0; i < jsonArraypartRevisions.size(); i++) { - PartDataRelationshipsPartRevisions.validateJsonElement(jsonArraypartRevisions.get(i)); + PartDataRelationshipsPartRevisionsInner.validateJsonElement(jsonArraypartRevisions.get(i)); }; } diff --git a/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java b/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisionsInner.java similarity index 80% rename from src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java rename to src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisionsInner.java index c4b7d42..8b684ee 100644 --- a/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisions.java +++ b/src/main/java/com/vertexvis/model/PartDataRelationshipsPartRevisionsInner.java @@ -47,10 +47,10 @@ import com.vertexvis.JSON; /** - * PartDataRelationshipsPartRevisions + * PartDataRelationshipsPartRevisionsInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") -public class PartDataRelationshipsPartRevisions { +public class PartDataRelationshipsPartRevisionsInner { /** * Resource object type. */ @@ -111,10 +111,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private UUID id; - public PartDataRelationshipsPartRevisions() { + public PartDataRelationshipsPartRevisionsInner() { } - public PartDataRelationshipsPartRevisions type(@javax.annotation.Nonnull TypeEnum type) { + public PartDataRelationshipsPartRevisionsInner type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -133,7 +133,7 @@ public void setType(@javax.annotation.Nonnull TypeEnum type) { } - public PartDataRelationshipsPartRevisions id(@javax.annotation.Nonnull UUID id) { + public PartDataRelationshipsPartRevisionsInner id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } @@ -161,9 +161,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PartDataRelationshipsPartRevisions partDataRelationshipsPartRevisions = (PartDataRelationshipsPartRevisions) o; - return Objects.equals(this.type, partDataRelationshipsPartRevisions.type) && - Objects.equals(this.id, partDataRelationshipsPartRevisions.id); + PartDataRelationshipsPartRevisionsInner partDataRelationshipsPartRevisionsInner = (PartDataRelationshipsPartRevisionsInner) o; + return Objects.equals(this.type, partDataRelationshipsPartRevisionsInner.type) && + Objects.equals(this.id, partDataRelationshipsPartRevisionsInner.id); } @Override @@ -174,7 +174,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PartDataRelationshipsPartRevisions {\n"); + sb.append("class PartDataRelationshipsPartRevisionsInner {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append("}"); @@ -212,25 +212,25 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to PartDataRelationshipsPartRevisions + * @throws IOException if the JSON Element is invalid with respect to PartDataRelationshipsPartRevisionsInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!PartDataRelationshipsPartRevisions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in PartDataRelationshipsPartRevisions is not found in the empty JSON string", PartDataRelationshipsPartRevisions.openapiRequiredFields.toString())); + if (!PartDataRelationshipsPartRevisionsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartDataRelationshipsPartRevisionsInner is not found in the empty JSON string", PartDataRelationshipsPartRevisionsInner.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!PartDataRelationshipsPartRevisions.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartDataRelationshipsPartRevisions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!PartDataRelationshipsPartRevisionsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PartDataRelationshipsPartRevisionsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : PartDataRelationshipsPartRevisions.openapiRequiredFields) { + for (String requiredField : PartDataRelationshipsPartRevisionsInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } @@ -250,22 +250,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!PartDataRelationshipsPartRevisions.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PartDataRelationshipsPartRevisions' and its subtypes + if (!PartDataRelationshipsPartRevisionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartDataRelationshipsPartRevisionsInner' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(PartDataRelationshipsPartRevisions.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartDataRelationshipsPartRevisionsInner.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, PartDataRelationshipsPartRevisions value) throws IOException { + public void write(JsonWriter out, PartDataRelationshipsPartRevisionsInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public PartDataRelationshipsPartRevisions read(JsonReader in) throws IOException { + public PartDataRelationshipsPartRevisionsInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -276,18 +276,18 @@ public PartDataRelationshipsPartRevisions read(JsonReader in) throws IOException } /** - * Create an instance of PartDataRelationshipsPartRevisions given an JSON string + * Create an instance of PartDataRelationshipsPartRevisionsInner given an JSON string * * @param jsonString JSON string - * @return An instance of PartDataRelationshipsPartRevisions - * @throws IOException if the JSON string is invalid with respect to PartDataRelationshipsPartRevisions + * @return An instance of PartDataRelationshipsPartRevisionsInner + * @throws IOException if the JSON string is invalid with respect to PartDataRelationshipsPartRevisionsInner */ - public static PartDataRelationshipsPartRevisions fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PartDataRelationshipsPartRevisions.class); + public static PartDataRelationshipsPartRevisionsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartDataRelationshipsPartRevisionsInner.class); } /** - * Convert an instance of PartDataRelationshipsPartRevisions to an JSON string + * Convert an instance of PartDataRelationshipsPartRevisionsInner to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java b/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java index abeb2ad..624fdcf 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java +++ b/src/main/java/com/vertexvis/model/PartRevisionDataAttributes.java @@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; @@ -62,7 +62,7 @@ public class PartRevisionDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_SUPPLIED_ID = "suppliedId"; @SerializedName(SERIALIZED_NAME_SUPPLIED_ID) @@ -101,12 +101,12 @@ public void setCreated(@javax.annotation.Nullable OffsetDateTime created) { } - public PartRevisionDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + public PartRevisionDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public PartRevisionDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public PartRevisionDataAttributes putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -119,11 +119,11 @@ public PartRevisionDataAttributes putMetadataItem(String key, UpdatePartRevision * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/PartRevisionRelationship.java b/src/main/java/com/vertexvis/model/PartRevisionRelationship.java index 2538338..83656fc 100644 --- a/src/main/java/com/vertexvis/model/PartRevisionRelationship.java +++ b/src/main/java/com/vertexvis/model/PartRevisionRelationship.java @@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.PartDataRelationshipsPartRevisions; +import com.vertexvis.model.PartDataRelationshipsPartRevisionsInner; import java.io.IOException; import java.util.Arrays; @@ -54,12 +54,12 @@ public class PartRevisionRelationship { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nonnull - private PartDataRelationshipsPartRevisions data; + private PartDataRelationshipsPartRevisionsInner data; public PartRevisionRelationship() { } - public PartRevisionRelationship data(@javax.annotation.Nonnull PartDataRelationshipsPartRevisions data) { + public PartRevisionRelationship data(@javax.annotation.Nonnull PartDataRelationshipsPartRevisionsInner data) { this.data = data; return this; } @@ -69,11 +69,11 @@ public PartRevisionRelationship data(@javax.annotation.Nonnull PartDataRelations * @return data */ @javax.annotation.Nonnull - public PartDataRelationshipsPartRevisions getData() { + public PartDataRelationshipsPartRevisionsInner getData() { return data; } - public void setData(@javax.annotation.Nonnull PartDataRelationshipsPartRevisions data) { + public void setData(@javax.annotation.Nonnull PartDataRelationshipsPartRevisionsInner data) { this.data = data; } @@ -159,7 +159,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the required field `data` - PartDataRelationshipsPartRevisions.validateJsonElement(jsonObj.get("data")); + PartDataRelationshipsPartRevisionsInner.validateJsonElement(jsonObj.get("data")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/vertexvis/model/PmiAnnotationData.java b/src/main/java/com/vertexvis/model/PmiAnnotationData.java index 0a41a3c..1477f3b 100644 --- a/src/main/java/com/vertexvis/model/PmiAnnotationData.java +++ b/src/main/java/com/vertexvis/model/PmiAnnotationData.java @@ -19,8 +19,8 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.vertexvis.model.CreateAccountRequestDataAttributes; import com.vertexvis.model.Link; +import com.vertexvis.model.ModelViewDataAttributes; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; @@ -68,7 +68,7 @@ public class PmiAnnotationData { public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) @javax.annotation.Nonnull - private CreateAccountRequestDataAttributes attributes; + private ModelViewDataAttributes attributes; public static final String SERIALIZED_NAME_LINKS = "links"; @SerializedName(SERIALIZED_NAME_LINKS) @@ -116,7 +116,7 @@ public void setId(@javax.annotation.Nonnull UUID id) { } - public PmiAnnotationData attributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + public PmiAnnotationData attributes(@javax.annotation.Nonnull ModelViewDataAttributes attributes) { this.attributes = attributes; return this; } @@ -126,11 +126,11 @@ public PmiAnnotationData attributes(@javax.annotation.Nonnull CreateAccountReque * @return attributes */ @javax.annotation.Nonnull - public CreateAccountRequestDataAttributes getAttributes() { + public ModelViewDataAttributes getAttributes() { return attributes; } - public void setAttributes(@javax.annotation.Nonnull CreateAccountRequestDataAttributes attributes) { + public void setAttributes(@javax.annotation.Nonnull ModelViewDataAttributes attributes) { this.attributes = attributes; } @@ -260,7 +260,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the required field `attributes` - CreateAccountRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + ModelViewDataAttributes.validateJsonElement(jsonObj.get("attributes")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java index 4519d66..ac578c7 100644 --- a/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java +++ b/src/main/java/com/vertexvis/model/PropertyEntryDataAttributes.java @@ -20,7 +20,6 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.PropertyEntryDataAttributesValue; -import com.vertexvis.model.PropertyKeyType; import java.io.IOException; import java.util.Arrays; @@ -60,7 +59,7 @@ public class PropertyEntryDataAttributes { public static final String SERIALIZED_NAME_KEY = "key"; @SerializedName(SERIALIZED_NAME_KEY) @javax.annotation.Nonnull - private PropertyKeyType key; + private String key; public PropertyEntryDataAttributes() { } @@ -84,7 +83,7 @@ public void setValue(@javax.annotation.Nonnull PropertyEntryDataAttributesValue } - public PropertyEntryDataAttributes key(@javax.annotation.Nonnull PropertyKeyType key) { + public PropertyEntryDataAttributes key(@javax.annotation.Nonnull String key) { this.key = key; return this; } @@ -94,11 +93,11 @@ public PropertyEntryDataAttributes key(@javax.annotation.Nonnull PropertyKeyType * @return key */ @javax.annotation.Nonnull - public PropertyKeyType getKey() { + public String getKey() { return key; } - public void setKey(@javax.annotation.Nonnull PropertyKeyType key) { + public void setKey(@javax.annotation.Nonnull String key) { this.key = key; } @@ -189,8 +188,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the required field `value` PropertyEntryDataAttributesValue.validateJsonElement(jsonObj.get("value")); - // validate the required field `key` - PropertyKeyType.validateJsonElement(jsonObj.get("key")); + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java b/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java index b5dec0b..7ee6d51 100644 --- a/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java +++ b/src/main/java/com/vertexvis/model/SceneItemDataAttributes.java @@ -21,8 +21,8 @@ import com.google.gson.stream.JsonWriter; import com.vertexvis.model.BoundingBox; import com.vertexvis.model.ColorMaterial; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import com.vertexvis.model.Matrix4; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; @@ -80,7 +80,7 @@ public class SceneItemDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -191,12 +191,12 @@ public void setMaterialOverride(@javax.annotation.Nullable ColorMaterial materia } - public SceneItemDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + public SceneItemDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public SceneItemDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public SceneItemDataAttributes putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -209,11 +209,11 @@ public SceneItemDataAttributes putMetadataItem(String key, UpdatePartRevisionReq * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java index e4082e4..9fedb03 100644 --- a/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java +++ b/src/main/java/com/vertexvis/model/UpdatePartRevisionRequestDataAttributesMetadataValue.java @@ -118,7 +118,7 @@ public void write(JsonWriter out, UpdatePartRevisionRequestDataAttributesMetadat elementAdapter.write(out, element); return; } - throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType"); } @Override @@ -126,6 +126,7 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); + int match = 0; ArrayList errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; @@ -134,9 +135,8 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) // validate the JSON object to see if any exception is thrown MetadataLongType.validateJsonElement(jsonElement); actualAdapter = adapterMetadataLongType; - UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; + match++; + log.log(Level.FINER, "Input data matches schema 'MetadataLongType'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); @@ -147,9 +147,8 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) // validate the JSON object to see if any exception is thrown MetadataFloatType.validateJsonElement(jsonElement); actualAdapter = adapterMetadataFloatType; - UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; + match++; + log.log(Level.FINER, "Input data matches schema 'MetadataFloatType'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); @@ -160,9 +159,8 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) // validate the JSON object to see if any exception is thrown MetadataDateType.validateJsonElement(jsonElement); actualAdapter = adapterMetadataDateType; - UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; + match++; + log.log(Level.FINER, "Input data matches schema 'MetadataDateType'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); @@ -173,9 +171,8 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) // validate the JSON object to see if any exception is thrown MetadataStringType.validateJsonElement(jsonElement); actualAdapter = adapterMetadataStringType; - UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; + match++; + log.log(Level.FINER, "Input data matches schema 'MetadataStringType'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); @@ -186,30 +183,35 @@ public UpdatePartRevisionRequestDataAttributesMetadataValue read(JsonReader in) // validate the JSON object to see if any exception is thrown MetadataNullType.validateJsonElement(jsonElement); actualAdapter = adapterMetadataNullType; - UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; + match++; + log.log(Level.FINER, "Input data matches schema 'MetadataNullType'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'MetadataNullType'", e); } - throw new IOException(String.format("Failed deserialization for UpdatePartRevisionRequestDataAttributesMetadataValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + if (match == 1) { + UpdatePartRevisionRequestDataAttributesMetadataValue ret = new UpdatePartRevisionRequestDataAttributesMetadataValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdatePartRevisionRequestDataAttributesMetadataValue: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } - // store a list of schema names defined in anyOf + // store a list of schema names defined in oneOf public static final Map> schemas = new HashMap>(); public UpdatePartRevisionRequestDataAttributesMetadataValue() { - super("anyOf", Boolean.FALSE); + super("oneOf", Boolean.FALSE); } public UpdatePartRevisionRequestDataAttributesMetadataValue(Object o) { - super("anyOf", Boolean.FALSE); + super("oneOf", Boolean.FALSE); setActualInstance(o); } @@ -227,11 +229,11 @@ public Map> getSchemas() { } /** - * Set the instance that matches the anyOf child schema, check - * the instance parameter is valid against the anyOf child schemas: + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: * MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType * - * It could be an instance of the 'anyOf' schemas. + * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { @@ -337,12 +339,13 @@ public MetadataNullType getMetadataNullType() throws ClassCastException { * @throws IOException if the JSON Element is invalid with respect to UpdatePartRevisionRequestDataAttributesMetadataValue */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - // validate anyOf schemas one by one + // validate oneOf schemas one by one + int validCount = 0; ArrayList errorMessages = new ArrayList<>(); // validate the json string with MetadataLongType try { MetadataLongType.validateJsonElement(jsonElement); - return; + validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for MetadataLongType failed with `%s`.", e.getMessage())); // continue to the next one @@ -350,7 +353,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // validate the json string with MetadataFloatType try { MetadataFloatType.validateJsonElement(jsonElement); - return; + validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for MetadataFloatType failed with `%s`.", e.getMessage())); // continue to the next one @@ -358,7 +361,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // validate the json string with MetadataDateType try { MetadataDateType.validateJsonElement(jsonElement); - return; + validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for MetadataDateType failed with `%s`.", e.getMessage())); // continue to the next one @@ -366,7 +369,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // validate the json string with MetadataStringType try { MetadataStringType.validateJsonElement(jsonElement); - return; + validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for MetadataStringType failed with `%s`.", e.getMessage())); // continue to the next one @@ -374,12 +377,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // validate the json string with MetadataNullType try { MetadataNullType.validateJsonElement(jsonElement); - return; + validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for MetadataNullType failed with `%s`.", e.getMessage())); // continue to the next one } - throw new IOException(String.format("The JSON string is invalid for UpdatePartRevisionRequestDataAttributesMetadataValue with anyOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdatePartRevisionRequestDataAttributesMetadataValue with oneOf schemas: MetadataDateType, MetadataFloatType, MetadataLongType, MetadataNullType, MetadataStringType. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } } /** diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java index 6e5f176..8855452 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataAttributes.java @@ -19,9 +19,9 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.vertexvis.model.CreatePartRequestDataAttributesMetadataValue; import com.vertexvis.model.MaterialOverride; import com.vertexvis.model.Matrix4; -import com.vertexvis.model.UpdatePartRevisionRequestDataAttributesMetadataValue; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; @@ -83,7 +83,7 @@ public class UpdateSceneItemRequestDataAttributes { public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) @javax.annotation.Nullable - private Map metadata = new HashMap<>(); + private Map metadata = new HashMap<>(); public static final String SERIALIZED_NAME_PHANTOM = "phantom"; @SerializedName(SERIALIZED_NAME_PHANTOM) @@ -193,12 +193,12 @@ public void setSuppliedId(@javax.annotation.Nullable String suppliedId) { } - public UpdateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { + public UpdateSceneItemRequestDataAttributes metadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; return this; } - public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePartRevisionRequestDataAttributesMetadataValue metadataItem) { + public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, CreatePartRequestDataAttributesMetadataValue metadataItem) { if (this.metadata == null) { this.metadata = new HashMap<>(); } @@ -211,11 +211,11 @@ public UpdateSceneItemRequestDataAttributes putMetadataItem(String key, UpdatePa * @return metadata */ @javax.annotation.Nullable - public Map getMetadata() { + public Map getMetadata() { return metadata; } - public void setMetadata(@javax.annotation.Nullable Map metadata) { + public void setMetadata(@javax.annotation.Nullable Map metadata) { this.metadata = metadata; } diff --git a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java index 6621a1b..edeb537 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneItemRequestDataRelationshipsSource.java @@ -20,7 +20,7 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vertexvis.model.GeometrySetRelationship; -import com.vertexvis.model.PartDataRelationshipsPartRevisions; +import com.vertexvis.model.PartDataRelationshipsPartRevisionsInner; import com.vertexvis.model.PartRevisionRelationship; import java.io.IOException; import java.util.Arrays; diff --git a/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java b/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java index af2a2a8..5e61d57 100644 --- a/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java +++ b/src/main/java/com/vertexvis/model/UpdateSceneRequestDataAttributes.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -305,22 +304,11 @@ public boolean equals(Object o) { Objects.equals(this.metadata, updateSceneRequestDataAttributes.metadata); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(camera, state, suppliedId, name, treeEnabled, worldOrientation, metadata); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - @Override public String toString() { StringBuilder sb = new StringBuilder();